diff --git a/.flake8 b/.flake8 index 29227d4c..2e438749 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 44c78f7c..757c9dca 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:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 00000000..311ebbb8 --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 00000000..41bff0b5 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +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 diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5..29601ad4 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,11 @@ 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: v1 + handleGHRelease: true + releaseType: python +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb8..238b87b9 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77..46d23716 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 diff --git a/CHANGELOG.md b/CHANGELOG.md index a3eb5685..f6d52e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,23 @@ [1]: https://pypi.org/project/google-cloud-iot/#history +## [2.5.0](https://github.com/googleapis/python-iot/compare/v2.4.1...v2.5.0) (2022-05-17) + + +### Features + +* AuditConfig for IAM v1 ([bc445c6](https://github.com/googleapis/python-iot/commit/bc445c6c8e90867b6c7d7d5bddab8abbc970deb3)) + + +### Bug Fixes + +* **deps:** require grpc-google-iam-v1 >=0.12.4 ([bc445c6](https://github.com/googleapis/python-iot/commit/bc445c6c8e90867b6c7d7d5bddab8abbc970deb3)) + + +### Documentation + +* fix type in docstring for map fields ([bc445c6](https://github.com/googleapis/python-iot/commit/bc445c6c8e90867b6c7d7d5bddab8abbc970deb3)) + ### [2.4.1](https://github.com/googleapis/python-iot/compare/v2.4.0...v2.4.1) (2022-03-05) diff --git a/docs/conf.py b/docs/conf.py index c85a516a..f82b687a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-iot", "google-cloud-iot Documentation", [author], 1,) + ( + root_doc, + "google-cloud-iot", + "google-cloud-iot Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,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/iot_v1/services/device_manager/async_client.py b/google/cloud/iot_v1/services/device_manager/async_client.py index 90cdf082..96d34392 100644 --- a/google/cloud/iot_v1/services/device_manager/async_client.py +++ b/google/cloud/iot_v1/services/device_manager/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -228,9 +228,9 @@ async def create_device_registry( from google.cloud import iot_v1 - def sample_create_device_registry(): + async def sample_create_device_registry(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.CreateDeviceRegistryRequest( @@ -238,7 +238,7 @@ def sample_create_device_registry(): ) # Make the request - response = client.create_device_registry(request=request) + response = await client.create_device_registry(request=request) # Handle the response print(response) @@ -307,7 +307,12 @@ def sample_create_device_registry(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -327,9 +332,9 @@ async def get_device_registry( from google.cloud import iot_v1 - def sample_get_device_registry(): + async def sample_get_device_registry(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.GetDeviceRegistryRequest( @@ -337,7 +342,7 @@ def sample_get_device_registry(): ) # Make the request - response = client.get_device_registry(request=request) + response = await client.get_device_registry(request=request) # Handle the response print(response) @@ -404,7 +409,12 @@ def sample_get_device_registry(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -425,16 +435,16 @@ async def update_device_registry( from google.cloud import iot_v1 - def sample_update_device_registry(): + async def sample_update_device_registry(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.UpdateDeviceRegistryRequest( ) # Make the request - response = client.update_device_registry(request=request) + response = await client.update_device_registry(request=request) # Handle the response print(response) @@ -508,7 +518,12 @@ def sample_update_device_registry(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -528,9 +543,9 @@ async def delete_device_registry( from google.cloud import iot_v1 - def sample_delete_device_registry(): + async def sample_delete_device_registry(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.DeleteDeviceRegistryRequest( @@ -538,7 +553,7 @@ def sample_delete_device_registry(): ) # Make the request - client.delete_device_registry(request=request) + await client.delete_device_registry(request=request) Args: request (Union[google.cloud.iot_v1.types.DeleteDeviceRegistryRequest, dict]): @@ -599,7 +614,10 @@ def sample_delete_device_registry(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_device_registries( @@ -617,9 +635,9 @@ async def list_device_registries( from google.cloud import iot_v1 - def sample_list_device_registries(): + async def sample_list_device_registries(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.ListDeviceRegistriesRequest( @@ -630,7 +648,7 @@ def sample_list_device_registries(): page_result = client.list_device_registries(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -700,12 +718,20 @@ def sample_list_device_registries(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDeviceRegistriesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -727,9 +753,9 @@ async def create_device( from google.cloud import iot_v1 - def sample_create_device(): + async def sample_create_device(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.CreateDeviceRequest( @@ -737,7 +763,7 @@ def sample_create_device(): ) # Make the request - response = client.create_device(request=request) + response = await client.create_device(request=request) # Handle the response print(response) @@ -806,7 +832,12 @@ def sample_create_device(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,9 +857,9 @@ async def get_device( from google.cloud import iot_v1 - def sample_get_device(): + async def sample_get_device(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.GetDeviceRequest( @@ -836,7 +867,7 @@ def sample_get_device(): ) # Make the request - response = client.get_device(request=request) + response = await client.get_device(request=request) # Handle the response print(response) @@ -905,7 +936,12 @@ def sample_get_device(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -926,16 +962,16 @@ async def update_device( from google.cloud import iot_v1 - def sample_update_device(): + async def sample_update_device(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.UpdateDeviceRequest( ) # Make the request - response = client.update_device(request=request) + response = await client.update_device(request=request) # Handle the response print(response) @@ -1009,7 +1045,12 @@ def sample_update_device(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1029,9 +1070,9 @@ async def delete_device( from google.cloud import iot_v1 - def sample_delete_device(): + async def sample_delete_device(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.DeleteDeviceRequest( @@ -1039,7 +1080,7 @@ def sample_delete_device(): ) # Make the request - client.delete_device(request=request) + await client.delete_device(request=request) Args: request (Union[google.cloud.iot_v1.types.DeleteDeviceRequest, dict]): @@ -1102,7 +1143,10 @@ def sample_delete_device(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_devices( @@ -1120,9 +1164,9 @@ async def list_devices( from google.cloud import iot_v1 - def sample_list_devices(): + async def sample_list_devices(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.ListDevicesRequest( @@ -1133,7 +1177,7 @@ def sample_list_devices(): page_result = client.list_devices(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1203,12 +1247,20 @@ def sample_list_devices(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListDevicesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1228,14 +1280,13 @@ async def modify_cloud_to_device_config( eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata. - .. code-block:: python from google.cloud import iot_v1 - def sample_modify_cloud_to_device_config(): + async def sample_modify_cloud_to_device_config(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.ModifyCloudToDeviceConfigRequest( @@ -1244,7 +1295,7 @@ def sample_modify_cloud_to_device_config(): ) # Make the request - response = client.modify_cloud_to_device_config(request=request) + response = await client.modify_cloud_to_device_config(request=request) # Handle the response print(response) @@ -1326,7 +1377,12 @@ def sample_modify_cloud_to_device_config(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1343,14 +1399,13 @@ async def list_device_config_versions( r"""Lists the last few versions of the device configuration in descending order (i.e.: newest first). - .. code-block:: python from google.cloud import iot_v1 - def sample_list_device_config_versions(): + async def sample_list_device_config_versions(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.ListDeviceConfigVersionsRequest( @@ -1358,7 +1413,7 @@ def sample_list_device_config_versions(): ) # Make the request - response = client.list_device_config_versions(request=request) + response = await client.list_device_config_versions(request=request) # Handle the response print(response) @@ -1428,7 +1483,12 @@ def sample_list_device_config_versions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1445,14 +1505,13 @@ async def list_device_states( r"""Lists the last few versions of the device state in descending order (i.e.: newest first). - .. code-block:: python from google.cloud import iot_v1 - def sample_list_device_states(): + async def sample_list_device_states(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.ListDeviceStatesRequest( @@ -1460,7 +1519,7 @@ def sample_list_device_states(): ) # Make the request - response = client.list_device_states(request=request) + response = await client.list_device_states(request=request) # Handle the response print(response) @@ -1529,7 +1588,12 @@ def sample_list_device_states(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1546,22 +1610,22 @@ async def set_iam_policy( r"""Sets the access control policy on the specified resource. Replaces any existing policy. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_set_iam_policy(): + async def sample_set_iam_policy(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) # Make the request - response = client.set_iam_policy(request=request) + response = await client.set_iam_policy(request=request) # Handle the response print(response) @@ -1587,21 +1651,26 @@ def sample_set_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + 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 to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + 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": [ @@ -1616,17 +1685,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1637,11 +1706,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1659,7 +1729,9 @@ def sample_set_iam_policy(): if isinstance(request, dict): request = iam_policy_pb2.SetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.SetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.SetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1676,7 +1748,12 @@ def sample_set_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1694,22 +1771,22 @@ async def get_iam_policy( Returns an empty policy if the resource exists and does not have a policy set. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_get_iam_policy(): + async def sample_get_iam_policy(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) # Make the request - response = client.get_iam_policy(request=request) + response = await client.get_iam_policy(request=request) # Handle the response print(response) @@ -1735,21 +1812,26 @@ def sample_get_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + 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 to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + 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": [ @@ -1764,17 +1846,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1785,11 +1867,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1807,7 +1890,9 @@ def sample_get_iam_policy(): if isinstance(request, dict): request = iam_policy_pb2.GetIamPolicyRequest(**request) elif not request: - request = iam_policy_pb2.GetIamPolicyRequest(resource=resource,) + request = iam_policy_pb2.GetIamPolicyRequest( + resource=resource, + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. @@ -1824,7 +1909,12 @@ def sample_get_iam_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1843,23 +1933,23 @@ async def test_iam_permissions( If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore - def sample_test_iam_permissions(): + async def sample_test_iam_permissions(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) # Make the request - response = client.test_iam_permissions(request=request) + response = await client.test_iam_permissions(request=request) # Handle the response print(response) @@ -1912,7 +2002,8 @@ def sample_test_iam_permissions(): request = iam_policy_pb2.TestIamPermissionsRequest(**request) elif not request: request = iam_policy_pb2.TestIamPermissionsRequest( - resource=resource, permissions=permissions, + resource=resource, + permissions=permissions, ) # Wrap the RPC method; this adds retry and timeout information, @@ -1930,7 +2021,12 @@ def sample_test_iam_permissions(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1964,14 +2060,13 @@ async def send_command_to_device( guaranteed; for QoS 0, no acknowledgment will be expected from the device. - .. code-block:: python from google.cloud import iot_v1 - def sample_send_command_to_device(): + async def sample_send_command_to_device(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.SendCommandToDeviceRequest( @@ -1980,7 +2075,7 @@ def sample_send_command_to_device(): ) # Make the request - response = client.send_command_to_device(request=request) + response = await client.send_command_to_device(request=request) # Handle the response print(response) @@ -2077,7 +2172,12 @@ def sample_send_command_to_device(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2099,9 +2199,9 @@ async def bind_device_to_gateway( from google.cloud import iot_v1 - def sample_bind_device_to_gateway(): + async def sample_bind_device_to_gateway(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.BindDeviceToGatewayRequest( @@ -2111,7 +2211,7 @@ def sample_bind_device_to_gateway(): ) # Make the request - response = client.bind_device_to_gateway(request=request) + response = await client.bind_device_to_gateway(request=request) # Handle the response print(response) @@ -2187,7 +2287,12 @@ def sample_bind_device_to_gateway(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2206,14 +2311,13 @@ async def unbind_device_from_gateway( r"""Deletes the association between the device and the gateway. - .. code-block:: python from google.cloud import iot_v1 - def sample_unbind_device_from_gateway(): + async def sample_unbind_device_from_gateway(): # Create a client - client = iot_v1.DeviceManagerClient() + client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) request = iot_v1.UnbindDeviceFromGatewayRequest( @@ -2223,7 +2327,7 @@ def sample_unbind_device_from_gateway(): ) # Make the request - response = client.unbind_device_from_gateway(request=request) + response = await client.unbind_device_from_gateway(request=request) # Handle the response print(response) @@ -2300,7 +2404,12 @@ def sample_unbind_device_from_gateway(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2314,7 +2423,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iot",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iot", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/iot_v1/services/device_manager/client.py b/google/cloud/iot_v1/services/device_manager/client.py index 7807f98d..12b0d66e 100644 --- a/google/cloud/iot_v1/services/device_manager/client.py +++ b/google/cloud/iot_v1/services/device_manager/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +59,10 @@ class DeviceManagerClientMeta(type): _transport_registry["grpc"] = DeviceManagerGrpcTransport _transport_registry["grpc_asyncio"] = DeviceManagerGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[DeviceManagerTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[DeviceManagerTransport]: """Returns an appropriate transport class. Args: @@ -166,10 +169,18 @@ def transport(self) -> DeviceManagerTransport: return self._transport @staticmethod - def device_path(project: str, location: str, registry: str, device: str,) -> str: + def device_path( + project: str, + location: str, + registry: str, + device: str, + ) -> str: """Returns a fully-qualified device string.""" return "projects/{project}/locations/{location}/registries/{registry}/devices/{device}".format( - project=project, location=location, registry=registry, device=device, + project=project, + location=location, + registry=registry, + device=device, ) @staticmethod @@ -182,10 +193,16 @@ def parse_device_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def registry_path(project: str, location: str, registry: str,) -> str: + def registry_path( + project: str, + location: str, + registry: str, + ) -> str: """Returns a fully-qualified registry string.""" return "projects/{project}/locations/{location}/registries/{registry}".format( - project=project, location=location, registry=registry, + project=project, + location=location, + registry=registry, ) @staticmethod @@ -198,7 +215,9 @@ def parse_registry_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @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, @@ -211,9 +230,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]: @@ -222,9 +245,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]: @@ -233,9 +260,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]: @@ -244,10 +275,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 @@ -516,7 +551,12 @@ def sample_create_device_registry(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -603,7 +643,12 @@ def sample_get_device_registry(): ) # Send the request. - 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,7 +752,12 @@ def sample_update_device_registry(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -788,7 +838,10 @@ def sample_delete_device_registry(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_device_registries( @@ -879,12 +932,20 @@ def sample_list_device_registries(): ) # 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.ListDeviceRegistriesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -985,7 +1046,12 @@ def sample_create_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 @@ -1074,7 +1140,12 @@ def sample_get_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 @@ -1178,7 +1249,12 @@ def sample_update_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 @@ -1261,7 +1337,10 @@ def sample_delete_device(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_devices( @@ -1352,12 +1431,20 @@ def sample_list_devices(): ) # 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.ListDevicesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1377,7 +1464,6 @@ def modify_cloud_to_device_config( eventually sent from the Cloud IoT Core servers. Returns the modified configuration version and its metadata. - .. code-block:: python from google.cloud import iot_v1 @@ -1466,7 +1552,12 @@ def sample_modify_cloud_to_device_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 @@ -1483,7 +1574,6 @@ def list_device_config_versions( r"""Lists the last few versions of the device configuration in descending order (i.e.: newest first). - .. code-block:: python from google.cloud import iot_v1 @@ -1560,7 +1650,12 @@ def sample_list_device_config_versions(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1577,7 +1672,6 @@ def list_device_states( r"""Lists the last few versions of the device state in descending order (i.e.: newest first). - .. code-block:: python from google.cloud import iot_v1 @@ -1651,7 +1745,12 @@ def sample_list_device_states(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1668,17 +1767,17 @@ def set_iam_policy( r"""Sets the access control policy on the specified resource. Replaces any existing policy. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): # Create a client client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) @@ -1709,21 +1808,26 @@ def sample_set_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + 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 to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + 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": [ @@ -1738,17 +1842,17 @@ def sample_set_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1759,11 +1863,12 @@ def sample_set_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1797,7 +1902,12 @@ def sample_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 @@ -1815,17 +1925,17 @@ def get_iam_policy( Returns an empty policy if the resource exists and does not have a policy set. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): # Create a client client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) @@ -1856,21 +1966,26 @@ def sample_get_iam_policy(): Returns: google.iam.v1.policy_pb2.Policy: - Defines an Identity and Access Management (IAM) policy. It is used to - specify access control policies for Cloud Platform - resources. + 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 to a single role. Members can be - user accounts, service accounts, Google groups, and - domains (such as G Suite). A role is a named list of - permissions (defined by IAM or configured by users). - A binding can optionally specify a condition, which - is a logic expression that further constrains the - role binding based on attributes about the request - and/or target resource. - - **JSON Example** + 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": [ @@ -1885,17 +2000,17 @@ def sample_get_iam_policy(): }, { "role": "roles/resourcemanager.organizationViewer", - "members": ["user:eve@example.com"], + "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** + **YAML example:** bindings: - members: - user:\ mike@example.com - group:\ admins@example.com - domain:google.com - @@ -1906,11 +2021,12 @@ def sample_get_iam_policy(): condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < - timestamp('2020-10-01T00:00:00.000Z') + timestamp('2020-10-01T00:00:00.000Z') etag: + BwWWja0YfJA= version: 3 For a description of IAM and its features, see the - [IAM developer's - guide](\ https://cloud.google.com/iam/docs). + [IAM + documentation](\ https://cloud.google.com/iam/docs/). """ # Create or coerce a protobuf request object. @@ -1944,7 +2060,12 @@ def sample_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 @@ -1963,17 +2084,17 @@ def test_iam_permissions( If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error. - .. code-block:: python from google.cloud import iot_v1 + from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): # Create a client client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) @@ -2049,7 +2170,12 @@ def sample_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 @@ -2083,7 +2209,6 @@ def send_command_to_device( guaranteed; for QoS 0, no acknowledgment will be expected from the device. - .. code-block:: python from google.cloud import iot_v1 @@ -2185,7 +2310,12 @@ def sample_send_command_to_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 @@ -2295,7 +2425,12 @@ def sample_bind_device_to_gateway(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2314,7 +2449,6 @@ def unbind_device_from_gateway( r"""Deletes the association between the device and the gateway. - .. code-block:: python from google.cloud import iot_v1 @@ -2410,7 +2544,12 @@ def sample_unbind_device_from_gateway(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -2431,7 +2570,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iot",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iot", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/iot_v1/services/device_manager/transports/base.py b/google/cloud/iot_v1/services/device_manager/transports/base.py index 029e3feb..c7c50d56 100644 --- a/google/cloud/iot_v1/services/device_manager/transports/base.py +++ b/google/cloud/iot_v1/services/device_manager/transports/base.py @@ -33,7 +33,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-iot",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-iot", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -85,6 +87,7 @@ def __init__( 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" @@ -181,7 +184,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.create_device: gapic_v1.method.wrap_method( - self.create_device, default_timeout=120.0, client_info=client_info, + self.create_device, + default_timeout=120.0, + client_info=client_info, ), self.get_device: gapic_v1.method.wrap_method( self.get_device, @@ -199,7 +204,9 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.update_device: gapic_v1.method.wrap_method( - self.update_device, default_timeout=120.0, client_info=client_info, + self.update_device, + default_timeout=120.0, + client_info=client_info, ), self.delete_device: gapic_v1.method.wrap_method( self.delete_device, @@ -278,10 +285,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=120.0, client_info=client_info, + self.set_iam_policy, + default_timeout=120.0, + client_info=client_info, ), self.get_iam_policy: gapic_v1.method.wrap_method( - self.get_iam_policy, default_timeout=120.0, client_info=client_info, + self.get_iam_policy, + default_timeout=120.0, + client_info=client_info, ), self.test_iam_permissions: gapic_v1.method.wrap_method( self.test_iam_permissions, @@ -319,9 +330,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() @@ -520,5 +531,9 @@ def unbind_device_from_gateway( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("DeviceManagerTransport",) diff --git a/google/cloud/iot_v1/services/device_manager/transports/grpc.py b/google/cloud/iot_v1/services/device_manager/transports/grpc.py index bb5e5d19..c612d853 100644 --- a/google/cloud/iot_v1/services/device_manager/transports/grpc.py +++ b/google/cloud/iot_v1/services/device_manager/transports/grpc.py @@ -229,8 +229,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -787,5 +786,9 @@ def unbind_device_from_gateway( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("DeviceManagerGrpcTransport",) diff --git a/google/cloud/iot_v1/types/device_manager.py b/google/cloud/iot_v1/types/device_manager.py index 60a87da3..579198cd 100644 --- a/google/cloud/iot_v1/types/device_manager.py +++ b/google/cloud/iot_v1/types/device_manager.py @@ -64,9 +64,14 @@ class CreateDeviceRegistryRequest(proto.Message): registry ``id`` provided and the ``parent`` field. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) device_registry = proto.Field( - proto.MESSAGE, number=2, message=resources.DeviceRegistry, + proto.MESSAGE, + number=2, + message=resources.DeviceRegistry, ) @@ -79,7 +84,10 @@ class GetDeviceRegistryRequest(proto.Message): ``projects/example-project/locations/us-central1/registries/my-registry``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteDeviceRegistryRequest(proto.Message): @@ -91,7 +99,10 @@ class DeleteDeviceRegistryRequest(proto.Message): ``projects/example-project/locations/us-central1/registries/my-registry``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateDeviceRegistryRequest(proto.Message): @@ -113,10 +124,14 @@ class UpdateDeviceRegistryRequest(proto.Message): """ device_registry = proto.Field( - proto.MESSAGE, number=1, message=resources.DeviceRegistry, + proto.MESSAGE, + number=1, + message=resources.DeviceRegistry, ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -140,9 +155,18 @@ class ListDeviceRegistriesRequest(proto.Message): the system should return the next page of data. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListDeviceRegistriesResponse(proto.Message): @@ -162,9 +186,14 @@ def raw_page(self): return self device_registries = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.DeviceRegistry, + proto.MESSAGE, + number=1, + message=resources.DeviceRegistry, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class CreateDeviceRequest(proto.Message): @@ -181,8 +210,15 @@ class CreateDeviceRequest(proto.Message): the device registry ``id`` and the ``parent`` field. """ - parent = proto.Field(proto.STRING, number=1,) - device = proto.Field(proto.MESSAGE, number=2, message=resources.Device,) + parent = proto.Field( + proto.STRING, + number=1, + ) + device = proto.Field( + proto.MESSAGE, + number=2, + message=resources.Device, + ) class GetDeviceRequest(proto.Message): @@ -201,8 +237,15 @@ class GetDeviceRequest(proto.Message): format, for example: ``last_heartbeat_time``. """ - name = proto.Field(proto.STRING, number=1,) - field_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,) + name = proto.Field( + proto.STRING, + number=1, + ) + field_mask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) class UpdateDeviceRequest(proto.Message): @@ -223,9 +266,15 @@ class UpdateDeviceRequest(proto.Message): ``metadata`` """ - device = proto.Field(proto.MESSAGE, number=2, message=resources.Device,) + device = proto.Field( + proto.MESSAGE, + number=2, + message=resources.Device, + ) update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=3, + message=field_mask_pb2.FieldMask, ) @@ -240,7 +289,10 @@ class DeleteDeviceRequest(proto.Message): ``projects/p0/locations/us-central1/registries/registry0/devices/{num_id}``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class ListDevicesRequest(proto.Message): @@ -277,15 +329,36 @@ class ListDevicesRequest(proto.Message): page of data. """ - parent = proto.Field(proto.STRING, number=1,) - device_num_ids = proto.RepeatedField(proto.UINT64, number=2,) - device_ids = proto.RepeatedField(proto.STRING, number=3,) - field_mask = proto.Field(proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask,) + parent = proto.Field( + proto.STRING, + number=1, + ) + device_num_ids = proto.RepeatedField( + proto.UINT64, + number=2, + ) + device_ids = proto.RepeatedField( + proto.STRING, + number=3, + ) + field_mask = proto.Field( + proto.MESSAGE, + number=4, + message=field_mask_pb2.FieldMask, + ) gateway_list_options = proto.Field( - proto.MESSAGE, number=6, message="GatewayListOptions", + proto.MESSAGE, + number=6, + message="GatewayListOptions", + ) + page_size = proto.Field( + proto.INT32, + number=100, + ) + page_token = proto.Field( + proto.STRING, + number=101, ) - page_size = proto.Field(proto.INT32, number=100,) - page_token = proto.Field(proto.STRING, number=101,) class GatewayListOptions(proto.Message): @@ -326,10 +399,21 @@ class GatewayListOptions(proto.Message): """ gateway_type = proto.Field( - proto.ENUM, number=1, oneof="filter", enum=resources.GatewayType, + proto.ENUM, + number=1, + oneof="filter", + enum=resources.GatewayType, + ) + associations_gateway_id = proto.Field( + proto.STRING, + number=2, + oneof="filter", + ) + associations_device_id = proto.Field( + proto.STRING, + number=3, + oneof="filter", ) - associations_gateway_id = proto.Field(proto.STRING, number=2, oneof="filter",) - associations_device_id = proto.Field(proto.STRING, number=3, oneof="filter",) class ListDevicesResponse(proto.Message): @@ -348,8 +432,15 @@ class ListDevicesResponse(proto.Message): def raw_page(self): return self - devices = proto.RepeatedField(proto.MESSAGE, number=1, message=resources.Device,) - next_page_token = proto.Field(proto.STRING, number=2,) + devices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.Device, + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ModifyCloudToDeviceConfigRequest(proto.Message): @@ -375,9 +466,18 @@ class ModifyCloudToDeviceConfigRequest(proto.Message): device. """ - name = proto.Field(proto.STRING, number=1,) - version_to_update = proto.Field(proto.INT64, number=2,) - binary_data = proto.Field(proto.BYTES, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + version_to_update = proto.Field( + proto.INT64, + number=2, + ) + binary_data = proto.Field( + proto.BYTES, + number=3, + ) class ListDeviceConfigVersionsRequest(proto.Message): @@ -397,8 +497,14 @@ class ListDeviceConfigVersionsRequest(proto.Message): the versions available. """ - name = proto.Field(proto.STRING, number=1,) - num_versions = proto.Field(proto.INT32, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + num_versions = proto.Field( + proto.INT32, + number=2, + ) class ListDeviceConfigVersionsResponse(proto.Message): @@ -412,7 +518,9 @@ class ListDeviceConfigVersionsResponse(proto.Message): """ device_configs = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.DeviceConfig, + proto.MESSAGE, + number=1, + message=resources.DeviceConfig, ) @@ -433,8 +541,14 @@ class ListDeviceStatesRequest(proto.Message): available. """ - name = proto.Field(proto.STRING, number=1,) - num_states = proto.Field(proto.INT32, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + num_states = proto.Field( + proto.INT32, + number=2, + ) class ListDeviceStatesResponse(proto.Message): @@ -448,7 +562,9 @@ class ListDeviceStatesResponse(proto.Message): """ device_states = proto.RepeatedField( - proto.MESSAGE, number=1, message=resources.DeviceState, + proto.MESSAGE, + number=1, + message=resources.DeviceState, ) @@ -476,14 +592,22 @@ class SendCommandToDeviceRequest(proto.Message): null characters. """ - name = proto.Field(proto.STRING, number=1,) - binary_data = proto.Field(proto.BYTES, number=2,) - subfolder = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + binary_data = proto.Field( + proto.BYTES, + number=2, + ) + subfolder = proto.Field( + proto.STRING, + number=3, + ) class SendCommandToDeviceResponse(proto.Message): - r"""Response for ``SendCommandToDevice``. - """ + r"""Response for ``SendCommandToDevice``.""" class BindDeviceToGatewayRequest(proto.Message): @@ -502,14 +626,22 @@ class BindDeviceToGatewayRequest(proto.Message): numeric ID or the user-defined device identifier. """ - parent = proto.Field(proto.STRING, number=1,) - gateway_id = proto.Field(proto.STRING, number=2,) - device_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + gateway_id = proto.Field( + proto.STRING, + number=2, + ) + device_id = proto.Field( + proto.STRING, + number=3, + ) class BindDeviceToGatewayResponse(proto.Message): - r"""Response for ``BindDeviceToGateway``. - """ + r"""Response for ``BindDeviceToGateway``.""" class UnbindDeviceFromGatewayRequest(proto.Message): @@ -528,14 +660,22 @@ class UnbindDeviceFromGatewayRequest(proto.Message): numeric ID or the user-defined device identifier. """ - parent = proto.Field(proto.STRING, number=1,) - gateway_id = proto.Field(proto.STRING, number=2,) - device_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + gateway_id = proto.Field( + proto.STRING, + number=2, + ) + device_id = proto.Field( + proto.STRING, + number=3, + ) class UnbindDeviceFromGatewayResponse(proto.Message): - r"""Response for ``UnbindDeviceFromGateway``. - """ + r"""Response for ``UnbindDeviceFromGateway``.""" __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/iot_v1/types/resources.py b/google/cloud/iot_v1/types/resources.py index 51869023..4637c7f3 100644 --- a/google/cloud/iot_v1/types/resources.py +++ b/google/cloud/iot_v1/types/resources.py @@ -195,7 +195,7 @@ class Device(proto.Message): The logging verbosity for device activity. If unspecified, DeviceRegistry.log_level will be used. - metadata (Sequence[google.cloud.iot_v1.types.Device.MetadataEntry]): + metadata (Mapping[str, str]): The metadata key-value pairs assigned to the device. This metadata is not interpreted or indexed by Cloud IoT Core. It can be used to add contextual information for the device. @@ -213,39 +213,87 @@ class Device(proto.Message): Gateway-related configuration and state. """ - id = proto.Field(proto.STRING, number=1,) - name = proto.Field(proto.STRING, number=2,) - num_id = proto.Field(proto.UINT64, number=3,) + id = proto.Field( + proto.STRING, + number=1, + ) + name = proto.Field( + proto.STRING, + number=2, + ) + num_id = proto.Field( + proto.UINT64, + number=3, + ) credentials = proto.RepeatedField( - proto.MESSAGE, number=12, message="DeviceCredential", + proto.MESSAGE, + number=12, + message="DeviceCredential", ) last_heartbeat_time = proto.Field( - proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, ) last_event_time = proto.Field( - proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=8, + message=timestamp_pb2.Timestamp, ) last_state_time = proto.Field( - proto.MESSAGE, number=20, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=20, + message=timestamp_pb2.Timestamp, ) last_config_ack_time = proto.Field( - proto.MESSAGE, number=14, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=14, + message=timestamp_pb2.Timestamp, ) last_config_send_time = proto.Field( - proto.MESSAGE, number=18, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=18, + message=timestamp_pb2.Timestamp, + ) + blocked = proto.Field( + proto.BOOL, + number=19, ) - blocked = proto.Field(proto.BOOL, number=19,) last_error_time = proto.Field( - proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=10, + message=timestamp_pb2.Timestamp, ) last_error_status = proto.Field( - proto.MESSAGE, number=11, message=status_pb2.Status, + proto.MESSAGE, + number=11, + message=status_pb2.Status, + ) + config = proto.Field( + proto.MESSAGE, + number=13, + message="DeviceConfig", + ) + state = proto.Field( + proto.MESSAGE, + number=16, + message="DeviceState", + ) + log_level = proto.Field( + proto.ENUM, + number=21, + enum="LogLevel", + ) + metadata = proto.MapField( + proto.STRING, + proto.STRING, + number=17, + ) + gateway_config = proto.Field( + proto.MESSAGE, + number=24, + message="GatewayConfig", ) - config = proto.Field(proto.MESSAGE, number=13, message="DeviceConfig",) - state = proto.Field(proto.MESSAGE, number=16, message="DeviceState",) - log_level = proto.Field(proto.ENUM, number=21, enum="LogLevel",) - metadata = proto.MapField(proto.STRING, proto.STRING, number=17,) - gateway_config = proto.Field(proto.MESSAGE, number=24, message="GatewayConfig",) class GatewayConfig(proto.Message): @@ -265,11 +313,24 @@ class GatewayConfig(proto.Message): accessed the gateway specified in ``last_accessed_gateway``. """ - gateway_type = proto.Field(proto.ENUM, number=1, enum="GatewayType",) - gateway_auth_method = proto.Field(proto.ENUM, number=2, enum="GatewayAuthMethod",) - last_accessed_gateway_id = proto.Field(proto.STRING, number=3,) + gateway_type = proto.Field( + proto.ENUM, + number=1, + enum="GatewayType", + ) + gateway_auth_method = proto.Field( + proto.ENUM, + number=2, + enum="GatewayAuthMethod", + ) + last_accessed_gateway_id = proto.Field( + proto.STRING, + number=3, + ) last_accessed_gateway_time = proto.Field( - proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, ) @@ -338,19 +399,43 @@ class DeviceRegistry(proto.Message): are revoked, deleted, or modified. """ - id = proto.Field(proto.STRING, number=1,) - name = proto.Field(proto.STRING, number=2,) + id = proto.Field( + proto.STRING, + number=1, + ) + name = proto.Field( + proto.STRING, + number=2, + ) event_notification_configs = proto.RepeatedField( - proto.MESSAGE, number=10, message="EventNotificationConfig", + proto.MESSAGE, + number=10, + message="EventNotificationConfig", ) state_notification_config = proto.Field( - proto.MESSAGE, number=7, message="StateNotificationConfig", + proto.MESSAGE, + number=7, + message="StateNotificationConfig", + ) + mqtt_config = proto.Field( + proto.MESSAGE, + number=4, + message="MqttConfig", + ) + http_config = proto.Field( + proto.MESSAGE, + number=9, + message="HttpConfig", + ) + log_level = proto.Field( + proto.ENUM, + number=11, + enum="LogLevel", ) - mqtt_config = proto.Field(proto.MESSAGE, number=4, message="MqttConfig",) - http_config = proto.Field(proto.MESSAGE, number=9, message="HttpConfig",) - log_level = proto.Field(proto.ENUM, number=11, enum="LogLevel",) credentials = proto.RepeatedField( - proto.MESSAGE, number=8, message="RegistryCredential", + proto.MESSAGE, + number=8, + message="RegistryCredential", ) @@ -364,7 +449,11 @@ class MqttConfig(proto.Message): registry will fail. """ - mqtt_enabled_state = proto.Field(proto.ENUM, number=1, enum="MqttState",) + mqtt_enabled_state = proto.Field( + proto.ENUM, + number=1, + enum="MqttState", + ) class HttpConfig(proto.Message): @@ -378,7 +467,11 @@ class HttpConfig(proto.Message): registry. """ - http_enabled_state = proto.Field(proto.ENUM, number=1, enum="HttpState",) + http_enabled_state = proto.Field( + proto.ENUM, + number=1, + enum="HttpState", + ) class EventNotificationConfig(proto.Message): @@ -397,8 +490,14 @@ class EventNotificationConfig(proto.Message): ``projects/myProject/topics/deviceEvents``. """ - subfolder_matches = proto.Field(proto.STRING, number=2,) - pubsub_topic_name = proto.Field(proto.STRING, number=1,) + subfolder_matches = proto.Field( + proto.STRING, + number=2, + ) + pubsub_topic_name = proto.Field( + proto.STRING, + number=1, + ) class StateNotificationConfig(proto.Message): @@ -411,7 +510,10 @@ class StateNotificationConfig(proto.Message): ``projects/myProject/topics/deviceEvents``. """ - pubsub_topic_name = proto.Field(proto.STRING, number=1,) + pubsub_topic_name = proto.Field( + proto.STRING, + number=1, + ) class RegistryCredential(proto.Message): @@ -430,7 +532,10 @@ class RegistryCredential(proto.Message): """ public_key_certificate = proto.Field( - proto.MESSAGE, number=1, oneof="credential", message="PublicKeyCertificate", + proto.MESSAGE, + number=1, + oneof="credential", + message="PublicKeyCertificate", ) @@ -454,12 +559,32 @@ class X509CertificateDetails(proto.Message): The type of public key in the certificate. """ - issuer = proto.Field(proto.STRING, number=1,) - subject = proto.Field(proto.STRING, number=2,) - start_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - expiry_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - signature_algorithm = proto.Field(proto.STRING, number=5,) - public_key_type = proto.Field(proto.STRING, number=6,) + issuer = proto.Field( + proto.STRING, + number=1, + ) + subject = proto.Field( + proto.STRING, + number=2, + ) + start_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + expiry_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + signature_algorithm = proto.Field( + proto.STRING, + number=5, + ) + public_key_type = proto.Field( + proto.STRING, + number=6, + ) class PublicKeyCertificate(proto.Message): @@ -475,10 +600,19 @@ class PublicKeyCertificate(proto.Message): certificates. """ - format = proto.Field(proto.ENUM, number=1, enum="PublicKeyCertificateFormat",) - certificate = proto.Field(proto.STRING, number=2,) + format = proto.Field( + proto.ENUM, + number=1, + enum="PublicKeyCertificateFormat", + ) + certificate = proto.Field( + proto.STRING, + number=2, + ) x509_details = proto.Field( - proto.MESSAGE, number=3, message="X509CertificateDetails", + proto.MESSAGE, + number=3, + message="X509CertificateDetails", ) @@ -515,10 +649,15 @@ class DeviceCredential(proto.Message): """ public_key = proto.Field( - proto.MESSAGE, number=2, oneof="credential", message="PublicKeyCredential", + proto.MESSAGE, + number=2, + oneof="credential", + message="PublicKeyCredential", ) expiration_time = proto.Field( - proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, ) @@ -532,8 +671,15 @@ class PublicKeyCredential(proto.Message): The key data. """ - format = proto.Field(proto.ENUM, number=1, enum="PublicKeyFormat",) - key = proto.Field(proto.STRING, number=2,) + format = proto.Field( + proto.ENUM, + number=1, + enum="PublicKeyFormat", + ) + key = proto.Field( + proto.STRING, + number=2, + ) class DeviceConfig(proto.Message): @@ -566,14 +712,24 @@ class DeviceConfig(proto.Message): The device configuration data. """ - version = proto.Field(proto.INT64, number=1,) + version = proto.Field( + proto.INT64, + number=1, + ) cloud_update_time = proto.Field( - proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, ) device_ack_time = proto.Field( - proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + binary_data = proto.Field( + proto.BYTES, + number=4, ) - binary_data = proto.Field(proto.BYTES, number=4,) class DeviceState(proto.Message): @@ -587,8 +743,15 @@ class DeviceState(proto.Message): The device state data. """ - update_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - binary_data = proto.Field(proto.BYTES, number=2,) + update_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + binary_data = proto.Field( + proto.BYTES, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c4..92da31f8 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,41 @@ import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_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() @@ -57,7 +82,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +94,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +126,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( @@ -118,6 +184,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.""" @@ -140,13 +235,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: diff --git a/owlbot.py b/owlbot.py index 5e3c46be..e4941d2e 100644 --- a/owlbot.py +++ b/owlbot.py @@ -48,6 +48,7 @@ # ---------------------------------------------------------------------------- python.py_samples() +python.configure_previous_major_version_branches() s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/samples/api-client/accesstoken_example/noxfile.py b/samples/api-client/accesstoken_example/noxfile.py index 400396ce..cf218d85 100644 --- a/samples/api-client/accesstoken_example/noxfile.py +++ b/samples/api-client/accesstoken_example/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/api-client/accesstoken_example/requirements-test.txt b/samples/api-client/accesstoken_example/requirements-test.txt index 1fb33361..c453d52e 100644 --- a/samples/api-client/accesstoken_example/requirements-test.txt +++ b/samples/api-client/accesstoken_example/requirements-test.txt @@ -1,3 +1,3 @@ -pytest==7.0.1 -google-cloud-pubsub==2.10.0 -google-cloud-storage==2.1.0 +pytest==7.1.2 +google-cloud-pubsub==2.12.1 +google-cloud-storage==2.3.0 diff --git a/samples/api-client/accesstoken_example/requirements.txt b/samples/api-client/accesstoken_example/requirements.txt index 2ce282d7..d4d8feff 100644 --- a/samples/api-client/accesstoken_example/requirements.txt +++ b/samples/api-client/accesstoken_example/requirements.txt @@ -1,10 +1,10 @@ -cryptography==36.0.1 +cryptography==37.0.2 flaky==3.7.0 -google-api-python-client==2.39.0 +google-api-python-client==2.48.0 google-auth-httplib2==0.1.0 -google-auth==2.6.0 -google-cloud-iot==2.4.0 -google-cloud-pubsub==2.10.0 -google-cloud-storage==2.1.0 +google-auth==2.6.6 +google-cloud-iot==2.4.1 +google-cloud-pubsub==2.12.1 +google-cloud-storage==2.3.0 paho-mqtt==1.6.1 -pyjwt==2.3.0 +pyjwt==2.4.0 diff --git a/samples/api-client/manager/noxfile.py b/samples/api-client/manager/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/api-client/manager/noxfile.py +++ b/samples/api-client/manager/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/api-client/manager/requirements-test.txt b/samples/api-client/manager/requirements-test.txt index c2845bff..d00689e0 100644 --- a/samples/api-client/manager/requirements-test.txt +++ b/samples/api-client/manager/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.1 +pytest==7.1.2 diff --git a/samples/api-client/manager/requirements.txt b/samples/api-client/manager/requirements.txt index be9f6dc9..f1fa1efa 100644 --- a/samples/api-client/manager/requirements.txt +++ b/samples/api-client/manager/requirements.txt @@ -1,9 +1,9 @@ -cryptography==36.0.1 +cryptography==37.0.2 flaky==3.7.0 -google-api-python-client==2.39.0 +google-api-python-client==2.48.0 google-auth-httplib2==0.1.0 -google-auth==2.6.0 -google-cloud-iot==2.4.0 -google-cloud-pubsub==2.10.0 +google-auth==2.6.6 +google-cloud-iot==2.4.1 +google-cloud-pubsub==2.12.1 paho-mqtt==1.6.1 -pyjwt==2.3.0 +pyjwt==2.4.0 diff --git a/samples/api-client/mqtt_example/noxfile.py b/samples/api-client/mqtt_example/noxfile.py index 400396ce..cf218d85 100644 --- a/samples/api-client/mqtt_example/noxfile.py +++ b/samples/api-client/mqtt_example/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/api-client/mqtt_example/requirements-test.txt b/samples/api-client/mqtt_example/requirements-test.txt index c2845bff..d00689e0 100644 --- a/samples/api-client/mqtt_example/requirements-test.txt +++ b/samples/api-client/mqtt_example/requirements-test.txt @@ -1 +1 @@ -pytest==7.0.1 +pytest==7.1.2 diff --git a/samples/api-client/mqtt_example/requirements.txt b/samples/api-client/mqtt_example/requirements.txt index 0779d49d..9f276ddf 100644 --- a/samples/api-client/mqtt_example/requirements.txt +++ b/samples/api-client/mqtt_example/requirements.txt @@ -1,2 +1,2 @@ paho-mqtt==1.6.1 -pyjwt==2.3.0 +pyjwt==2.4.0 diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_async.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_async.py index 36f79b64..129e55b0 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_async.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_async.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_GetIamPolicy_async] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_get_iam_policy(): @@ -32,7 +33,7 @@ async def sample_get_iam_policy(): client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_sync.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_sync.py index f0e08a17..48e9dc9e 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_sync.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_get_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_GetIamPolicy_sync] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_get_iam_policy(): @@ -32,7 +33,7 @@ def sample_get_iam_policy(): client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.GetIamPolicyRequest( + request = iam_policy_pb2.GetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_async.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_async.py index 3209a09f..6e3785a8 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_async.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_async.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_SetIamPolicy_async] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_set_iam_policy(): @@ -32,7 +33,7 @@ async def sample_set_iam_policy(): client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_sync.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_sync.py index a23d1a10..a9b664bd 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_sync.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_set_iam_policy_sync.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_SetIamPolicy_sync] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_set_iam_policy(): @@ -32,7 +33,7 @@ def sample_set_iam_policy(): client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.SetIamPolicyRequest( + request = iam_policy_pb2.SetIamPolicyRequest( resource="resource_value", ) diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_async.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_async.py index eb6a4271..8eeab2a5 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_async.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_async.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_TestIamPermissions_async] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore async def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ async def sample_test_iam_permissions(): client = iot_v1.DeviceManagerAsyncClient() # Initialize request argument(s) - request = iot_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py b/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py index 76603816..bcdee786 100644 --- a/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py +++ b/samples/generated_samples/cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py @@ -25,6 +25,7 @@ # [START cloudiot_v1_generated_DeviceManager_TestIamPermissions_sync] from google.cloud import iot_v1 +from google.iam.v1 import iam_policy_pb2 # type: ignore def sample_test_iam_permissions(): @@ -32,7 +33,7 @@ def sample_test_iam_permissions(): client = iot_v1.DeviceManagerClient() # Initialize request argument(s) - request = iot_v1.TestIamPermissionsRequest( + request = iam_policy_pb2.TestIamPermissionsRequest( resource="resource_value", permissions=['permissions_value_1', 'permissions_value_2'], ) diff --git a/samples/generated_samples/snippet_metadata_iot_v1.json b/samples/generated_samples/snippet_metadata_iot_v1.json index 975ad0e3..b4128560 100644 --- a/samples/generated_samples/snippet_metadata_iot_v1.json +++ b/samples/generated_samples/snippet_metadata_iot_v1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.iot.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-iot" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.bind_device_to_gateway", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "BindDeviceToGateway" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.BindDeviceToGatewayRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "gateway_id", + "type": "str" + }, + { + "name": "device_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.BindDeviceToGatewayResponse", + "shortName": "bind_device_to_gateway" }, + "description": "Sample for BindDeviceToGateway", "file": "cloudiot_v1_generated_device_manager_bind_device_to_gateway_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_bind_device_to_gateway_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.bind_device_to_gateway", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.BindDeviceToGateway", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "BindDeviceToGateway" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.BindDeviceToGatewayRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "gateway_id", + "type": "str" + }, + { + "name": "device_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.BindDeviceToGatewayResponse", + "shortName": "bind_device_to_gateway" }, + "description": "Sample for BindDeviceToGateway", "file": "cloudiot_v1_generated_device_manager_bind_device_to_gateway_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_BindDeviceToGateway_sync", "segments": [ { @@ -87,19 +184,59 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_bind_device_to_gateway_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.create_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "CreateDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.CreateDeviceRegistryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "device_registry", + "type": "google.cloud.iot_v1.types.DeviceRegistry" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "create_device_registry" }, + "description": "Sample for CreateDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_create_device_registry_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_async", "segments": [ { @@ -132,18 +269,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_create_device_registry_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.create_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "CreateDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.CreateDeviceRegistryRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "device_registry", + "type": "google.cloud.iot_v1.types.DeviceRegistry" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "create_device_registry" }, + "description": "Sample for CreateDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_create_device_registry_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDeviceRegistry_sync", "segments": [ { @@ -176,19 +353,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_create_device_registry_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.create_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "CreateDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.CreateDeviceRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "device", + "type": "google.cloud.iot_v1.types.Device" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "create_device" }, + "description": "Sample for CreateDevice", "file": "cloudiot_v1_generated_device_manager_create_device_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDevice_async", "segments": [ { @@ -221,18 +438,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_create_device_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.create_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.CreateDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "CreateDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.CreateDeviceRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "device", + "type": "google.cloud.iot_v1.types.Device" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "create_device" }, + "description": "Sample for CreateDevice", "file": "cloudiot_v1_generated_device_manager_create_device_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_CreateDevice_sync", "segments": [ { @@ -265,19 +522,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_create_device_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.delete_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "DeleteDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.DeleteDeviceRegistryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_device_registry" }, + "description": "Sample for DeleteDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_delete_device_registry_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_async", "segments": [ { @@ -308,18 +600,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_delete_device_registry_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.delete_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "DeleteDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.DeleteDeviceRegistryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_device_registry" }, + "description": "Sample for DeleteDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_delete_device_registry_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDeviceRegistry_sync", "segments": [ { @@ -350,19 +677,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_delete_device_registry_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.delete_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "DeleteDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.DeleteDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_device" }, + "description": "Sample for DeleteDevice", "file": "cloudiot_v1_generated_device_manager_delete_device_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDevice_async", "segments": [ { @@ -393,18 +755,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_delete_device_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.delete_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.DeleteDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "DeleteDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.DeleteDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_device" }, + "description": "Sample for DeleteDevice", "file": "cloudiot_v1_generated_device_manager_delete_device_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_DeleteDevice_sync", "segments": [ { @@ -435,19 +832,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_delete_device_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.get_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.GetDeviceRegistryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "get_device_registry" }, + "description": "Sample for GetDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_get_device_registry_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_async", "segments": [ { @@ -480,18 +913,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_device_registry_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.get_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.GetDeviceRegistryRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "get_device_registry" }, + "description": "Sample for GetDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_get_device_registry_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetDeviceRegistry_sync", "segments": [ { @@ -524,19 +993,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_device_registry_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.get_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.GetDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "get_device" }, + "description": "Sample for GetDevice", "file": "cloudiot_v1_generated_device_manager_get_device_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetDevice_async", "segments": [ { @@ -569,18 +1074,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_device_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.get_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.GetDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "get_device" }, + "description": "Sample for GetDevice", "file": "cloudiot_v1_generated_device_manager_get_device_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetDevice_sync", "segments": [ { @@ -613,108 +1154,216 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_device_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.get_iam_policy", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "cloudiot_v1_generated_device_manager_get_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.get_iam_policy", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.GetIamPolicy", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "GetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.GetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "get_iam_policy" }, + "description": "Sample for GetIamPolicy", "file": "cloudiot_v1_generated_device_manager_get_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_GetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_get_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.list_device_config_versions", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceConfigVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceConfigVersionsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.ListDeviceConfigVersionsResponse", + "shortName": "list_device_config_versions" }, + "description": "Sample for ListDeviceConfigVersions", "file": "cloudiot_v1_generated_device_manager_list_device_config_versions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_async", "segments": [ { @@ -747,18 +1396,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_config_versions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.list_device_config_versions", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceConfigVersions", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceConfigVersions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceConfigVersionsRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.ListDeviceConfigVersionsResponse", + "shortName": "list_device_config_versions" }, + "description": "Sample for ListDeviceConfigVersions", "file": "cloudiot_v1_generated_device_manager_list_device_config_versions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceConfigVersions_sync", "segments": [ { @@ -791,19 +1476,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_config_versions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.list_device_registries", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceRegistries" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceRegistriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.services.device_manager.pagers.ListDeviceRegistriesAsyncPager", + "shortName": "list_device_registries" }, + "description": "Sample for ListDeviceRegistries", "file": "cloudiot_v1_generated_device_manager_list_device_registries_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_async", "segments": [ { @@ -836,18 +1557,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_registries_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.list_device_registries", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceRegistries", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceRegistries" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceRegistriesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.services.device_manager.pagers.ListDeviceRegistriesPager", + "shortName": "list_device_registries" }, + "description": "Sample for ListDeviceRegistries", "file": "cloudiot_v1_generated_device_manager_list_device_registries_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceRegistries_sync", "segments": [ { @@ -880,19 +1637,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_registries_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.list_device_states", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceStates" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceStatesRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.ListDeviceStatesResponse", + "shortName": "list_device_states" }, + "description": "Sample for ListDeviceStates", "file": "cloudiot_v1_generated_device_manager_list_device_states_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceStates_async", "segments": [ { @@ -925,18 +1718,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_states_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.list_device_states", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDeviceStates", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDeviceStates" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDeviceStatesRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.ListDeviceStatesResponse", + "shortName": "list_device_states" }, + "description": "Sample for ListDeviceStates", "file": "cloudiot_v1_generated_device_manager_list_device_states_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDeviceStates_sync", "segments": [ { @@ -969,19 +1798,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_device_states_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.list_devices", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDevices" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDevicesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.services.device_manager.pagers.ListDevicesAsyncPager", + "shortName": "list_devices" }, + "description": "Sample for ListDevices", "file": "cloudiot_v1_generated_device_manager_list_devices_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDevices_async", "segments": [ { @@ -1014,18 +1879,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_devices_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.list_devices", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ListDevices", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ListDevices" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ListDevicesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.services.device_manager.pagers.ListDevicesPager", + "shortName": "list_devices" }, + "description": "Sample for ListDevices", "file": "cloudiot_v1_generated_device_manager_list_devices_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ListDevices_sync", "segments": [ { @@ -1058,19 +1959,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_list_devices_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.modify_cloud_to_device_config", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ModifyCloudToDeviceConfig" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ModifyCloudToDeviceConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "binary_data", + "type": "bytes" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceConfig", + "shortName": "modify_cloud_to_device_config" }, + "description": "Sample for ModifyCloudToDeviceConfig", "file": "cloudiot_v1_generated_device_manager_modify_cloud_to_device_config_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_async", "segments": [ { @@ -1103,18 +2044,58 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_modify_cloud_to_device_config_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.modify_cloud_to_device_config", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.ModifyCloudToDeviceConfig", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "ModifyCloudToDeviceConfig" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.ModifyCloudToDeviceConfigRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "binary_data", + "type": "bytes" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceConfig", + "shortName": "modify_cloud_to_device_config" }, + "description": "Sample for ModifyCloudToDeviceConfig", "file": "cloudiot_v1_generated_device_manager_modify_cloud_to_device_config_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_ModifyCloudToDeviceConfig_sync", "segments": [ { @@ -1147,19 +2128,63 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_modify_cloud_to_device_config_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.send_command_to_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "SendCommandToDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.SendCommandToDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "binary_data", + "type": "bytes" + }, + { + "name": "subfolder", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.SendCommandToDeviceResponse", + "shortName": "send_command_to_device" }, + "description": "Sample for SendCommandToDevice", "file": "cloudiot_v1_generated_device_manager_send_command_to_device_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_SendCommandToDevice_async", "segments": [ { @@ -1192,18 +2217,62 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_send_command_to_device_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.send_command_to_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.SendCommandToDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "SendCommandToDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.SendCommandToDeviceRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "binary_data", + "type": "bytes" + }, + { + "name": "subfolder", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.SendCommandToDeviceResponse", + "shortName": "send_command_to_device" }, + "description": "Sample for SendCommandToDevice", "file": "cloudiot_v1_generated_device_manager_send_command_to_device_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_SendCommandToDevice_sync", "segments": [ { @@ -1236,197 +2305,393 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_send_command_to_device_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.set_iam_policy", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.SetIamPolicy", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "cloudiot_v1_generated_device_manager_set_iam_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_SetIamPolicy_async", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_set_iam_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.set_iam_policy", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.SetIamPolicy", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "SetIamPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.SetIamPolicyRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.policy_pb2.Policy", + "shortName": "set_iam_policy" }, + "description": "Sample for SetIamPolicy", "file": "cloudiot_v1_generated_device_manager_set_iam_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_SetIamPolicy_sync", "segments": [ { - "end": 44, + "end": 45, "start": 27, "type": "FULL" }, { - "end": 44, + "end": 45, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 38, - "start": 34, + "end": 39, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 41, - "start": 39, + "end": 42, + "start": 40, "type": "REQUEST_EXECUTION" }, { - "end": 45, - "start": 42, + "end": 46, + "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_set_iam_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.test_iam_permissions", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "permissions", + "type": "Sequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "cloudiot_v1_generated_device_manager_test_iam_permissions_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_TestIamPermissions_async", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_test_iam_permissions_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.test_iam_permissions", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.TestIamPermissions", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "TestIamPermissions" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest" + }, + { + "name": "resource", + "type": "str" + }, + { + "name": "permissions", + "type": "Sequence[str]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse", + "shortName": "test_iam_permissions" }, + "description": "Sample for TestIamPermissions", "file": "cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_TestIamPermissions_sync", "segments": [ { - "end": 45, + "end": 46, "start": 27, "type": "FULL" }, { - "end": 45, + "end": 46, "start": 27, "type": "SHORT" }, { - "end": 33, - "start": 31, + "end": 34, + "start": 32, "type": "CLIENT_INITIALIZATION" }, { - "end": 39, - "start": 34, + "end": 40, + "start": 35, "type": "REQUEST_INITIALIZATION" }, { - "end": 42, - "start": 40, + "end": 43, + "start": 41, "type": "REQUEST_EXECUTION" }, { - "end": 46, - "start": 43, + "end": 47, + "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_test_iam_permissions_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.unbind_device_from_gateway", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UnbindDeviceFromGateway" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UnbindDeviceFromGatewayRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "gateway_id", + "type": "str" + }, + { + "name": "device_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.UnbindDeviceFromGatewayResponse", + "shortName": "unbind_device_from_gateway" }, + "description": "Sample for UnbindDeviceFromGateway", "file": "cloudiot_v1_generated_device_manager_unbind_device_from_gateway_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_async", "segments": [ { @@ -1459,18 +2724,62 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_unbind_device_from_gateway_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.unbind_device_from_gateway", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UnbindDeviceFromGateway", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UnbindDeviceFromGateway" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UnbindDeviceFromGatewayRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "gateway_id", + "type": "str" + }, + { + "name": "device_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.UnbindDeviceFromGatewayResponse", + "shortName": "unbind_device_from_gateway" }, + "description": "Sample for UnbindDeviceFromGateway", "file": "cloudiot_v1_generated_device_manager_unbind_device_from_gateway_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UnbindDeviceFromGateway_sync", "segments": [ { @@ -1503,19 +2812,59 @@ "start": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_unbind_device_from_gateway_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.update_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UpdateDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UpdateDeviceRegistryRequest" + }, + { + "name": "device_registry", + "type": "google.cloud.iot_v1.types.DeviceRegistry" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "update_device_registry" }, + "description": "Sample for UpdateDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_update_device_registry_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_async", "segments": [ { @@ -1548,18 +2897,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_update_device_registry_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.update_device_registry", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDeviceRegistry", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UpdateDeviceRegistry" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UpdateDeviceRegistryRequest" + }, + { + "name": "device_registry", + "type": "google.cloud.iot_v1.types.DeviceRegistry" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.DeviceRegistry", + "shortName": "update_device_registry" }, + "description": "Sample for UpdateDeviceRegistry", "file": "cloudiot_v1_generated_device_manager_update_device_registry_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDeviceRegistry_sync", "segments": [ { @@ -1592,19 +2981,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_update_device_registry_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient", + "shortName": "DeviceManagerAsyncClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerAsyncClient.update_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UpdateDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UpdateDeviceRequest" + }, + { + "name": "device", + "type": "google.cloud.iot_v1.types.Device" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "update_device" }, + "description": "Sample for UpdateDevice", "file": "cloudiot_v1_generated_device_manager_update_device_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDevice_async", "segments": [ { @@ -1637,18 +3066,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_update_device_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.iot_v1.DeviceManagerClient", + "shortName": "DeviceManagerClient" + }, + "fullName": "google.cloud.iot_v1.DeviceManagerClient.update_device", "method": { + "fullName": "google.cloud.iot.v1.DeviceManager.UpdateDevice", "service": { + "fullName": "google.cloud.iot.v1.DeviceManager", "shortName": "DeviceManager" }, "shortName": "UpdateDevice" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.iot_v1.types.UpdateDeviceRequest" + }, + { + "name": "device", + "type": "google.cloud.iot_v1.types.Device" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.iot_v1.types.Device", + "shortName": "update_device" }, + "description": "Sample for UpdateDevice", "file": "cloudiot_v1_generated_device_manager_update_device_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "cloudiot_v1_generated_DeviceManager_UpdateDevice_sync", "segments": [ { @@ -1681,7 +3150,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "cloudiot_v1_generated_device_manager_update_device_sync.py" } ] } diff --git a/scripts/fixup_iot_v1_keywords.py b/scripts/fixup_iot_v1_keywords.py index 41d74f8a..f59d0544 100644 --- a/scripts/fixup_iot_v1_keywords.py +++ b/scripts/fixup_iot_v1_keywords.py @@ -53,7 +53,7 @@ class iotCallTransformer(cst.CSTTransformer): 'list_device_states': ('name', 'num_states', ), 'modify_cloud_to_device_config': ('name', 'binary_data', 'version_to_update', ), 'send_command_to_device': ('name', 'binary_data', 'subfolder', ), - 'set_iam_policy': ('resource', 'policy', ), + 'set_iam_policy': ('resource', 'policy', 'update_mask', ), 'test_iam_permissions': ('resource', 'permissions', ), 'unbind_device_from_gateway': ('parent', 'gateway_id', 'device_id', ), 'update_device': ('device', 'update_mask', ), diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e9..91b59676 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 8ac8a75e..196dfb84 100644 --- a/setup.py +++ b/setup.py @@ -19,14 +19,14 @@ name = "google-cloud-iot" description = "Cloud IoT API API client library" -version = "2.4.1" +version = "2.5.0" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "grpc-google-iam-v1 >= 0.12.3, < 0.13dev", + "grpc-google-iam-v1 >= 0.12.4, <1.0.0dev", "proto-plus >= 1.15.0", ] diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index 97384ff6..5a93d69c 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -6,4 +6,4 @@ # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 -grpc-google-iam-v1==0.12.3 +grpc-google-iam-v1==0.12.4 diff --git a/tests/unit/gapic/iot_v1/test_device_manager.py b/tests/unit/gapic/iot_v1/test_device_manager.py index 7d97fad1..d60b8529 100644 --- a/tests/unit/gapic/iot_v1/test_device_manager.py +++ b/tests/unit/gapic/iot_v1/test_device_manager.py @@ -94,20 +94,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [DeviceManagerClient, DeviceManagerAsyncClient,] + "client_class,transport_name", + [ + (DeviceManagerClient, "grpc"), + (DeviceManagerAsyncClient, "grpc_asyncio"), + ], ) -def test_device_manager_client_from_service_account_info(client_class): +def test_device_manager_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) + 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 == "cloudiot.googleapis.com:443" + assert client.transport._host == ("cloudiot.googleapis.com:443") @pytest.mark.parametrize( @@ -136,23 +140,31 @@ def test_device_manager_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [DeviceManagerClient, DeviceManagerAsyncClient,] + "client_class,transport_name", + [ + (DeviceManagerClient, "grpc"), + (DeviceManagerAsyncClient, "grpc_asyncio"), + ], ) -def test_device_manager_client_from_service_account_file(client_class): +def test_device_manager_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") + 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") + 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 == "cloudiot.googleapis.com:443" + assert client.transport._host == ("cloudiot.googleapis.com:443") def test_device_manager_client_get_transport_class(): @@ -500,7 +512,9 @@ def test_device_manager_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) @@ -644,11 +658,16 @@ def test_device_manager_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [device_manager.CreateDeviceRegistryRequest, dict,] + "request_type", + [ + device_manager.CreateDeviceRegistryRequest, + dict, + ], ) def test_create_device_registry(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -661,7 +680,9 @@ def test_create_device_registry(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) response = client.create_device_registry(request) @@ -681,7 +702,8 @@ def test_create_device_registry_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -700,7 +722,8 @@ async def test_create_device_registry_async( request_type=device_manager.CreateDeviceRegistryRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -714,7 +737,9 @@ async def test_create_device_registry_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) ) response = await client.create_device_registry(request) @@ -737,13 +762,15 @@ async def test_create_device_registry_async_from_dict(): def test_create_device_registry_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.CreateDeviceRegistryRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -759,7 +786,10 @@ def test_create_device_registry_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -772,7 +802,7 @@ async def test_create_device_registry_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.CreateDeviceRegistryRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -790,11 +820,16 @@ async def test_create_device_registry_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_device_registry_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -822,7 +857,9 @@ def test_create_device_registry_flattened(): def test_create_device_registry_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -886,11 +923,16 @@ async def test_create_device_registry_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.GetDeviceRegistryRequest, dict,] + "request_type", + [ + device_manager.GetDeviceRegistryRequest, + dict, + ], ) def test_get_device_registry(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -903,7 +945,9 @@ def test_get_device_registry(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) response = client.get_device_registry(request) @@ -923,7 +967,8 @@ def test_get_device_registry_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -942,7 +987,8 @@ async def test_get_device_registry_async( request_type=device_manager.GetDeviceRegistryRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -956,7 +1002,9 @@ async def test_get_device_registry_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) ) response = await client.get_device_registry(request) @@ -979,13 +1027,15 @@ async def test_get_device_registry_async_from_dict(): def test_get_device_registry_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.GetDeviceRegistryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1001,7 +1051,10 @@ def test_get_device_registry_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1014,7 +1067,7 @@ async def test_get_device_registry_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.GetDeviceRegistryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1032,11 +1085,16 @@ async def test_get_device_registry_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_device_registry_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1046,7 +1104,9 @@ def test_get_device_registry_flattened(): call.return_value = resources.DeviceRegistry() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_device_registry(name="name_value",) + client.get_device_registry( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1058,13 +1118,16 @@ def test_get_device_registry_flattened(): def test_get_device_registry_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_device_registry( - device_manager.GetDeviceRegistryRequest(), name="name_value", + device_manager.GetDeviceRegistryRequest(), + name="name_value", ) @@ -1086,7 +1149,9 @@ async def test_get_device_registry_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_device_registry(name="name_value",) + response = await client.get_device_registry( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1107,16 +1172,22 @@ async def test_get_device_registry_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_device_registry( - device_manager.GetDeviceRegistryRequest(), name="name_value", + device_manager.GetDeviceRegistryRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [device_manager.UpdateDeviceRegistryRequest, dict,] + "request_type", + [ + device_manager.UpdateDeviceRegistryRequest, + dict, + ], ) def test_update_device_registry(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1129,7 +1200,9 @@ def test_update_device_registry(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) response = client.update_device_registry(request) @@ -1149,7 +1222,8 @@ def test_update_device_registry_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1168,7 +1242,8 @@ async def test_update_device_registry_async( request_type=device_manager.UpdateDeviceRegistryRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1182,7 +1257,9 @@ async def test_update_device_registry_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.DeviceRegistry( - id="id_value", name="name_value", log_level=resources.LogLevel.NONE, + id="id_value", + name="name_value", + log_level=resources.LogLevel.NONE, ) ) response = await client.update_device_registry(request) @@ -1205,13 +1282,15 @@ async def test_update_device_registry_async_from_dict(): def test_update_device_registry_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.UpdateDeviceRegistryRequest() - request.device_registry.name = "device_registry.name/value" + request.device_registry.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1229,7 +1308,7 @@ def test_update_device_registry_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "device_registry.name=device_registry.name/value", + "device_registry.name=name_value", ) in kw["metadata"] @@ -1243,7 +1322,7 @@ async def test_update_device_registry_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.UpdateDeviceRegistryRequest() - request.device_registry.name = "device_registry.name/value" + request.device_registry.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1263,12 +1342,14 @@ async def test_update_device_registry_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "device_registry.name=device_registry.name/value", + "device_registry.name=name_value", ) in kw["metadata"] def test_update_device_registry_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1296,7 +1377,9 @@ def test_update_device_registry_flattened(): def test_update_device_registry_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1360,11 +1443,16 @@ async def test_update_device_registry_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.DeleteDeviceRegistryRequest, dict,] + "request_type", + [ + device_manager.DeleteDeviceRegistryRequest, + dict, + ], ) def test_delete_device_registry(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1392,7 +1480,8 @@ def test_delete_device_registry_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1411,7 +1500,8 @@ async def test_delete_device_registry_async( request_type=device_manager.DeleteDeviceRegistryRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1441,13 +1531,15 @@ async def test_delete_device_registry_async_from_dict(): def test_delete_device_registry_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.DeleteDeviceRegistryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1463,7 +1555,10 @@ def test_delete_device_registry_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1476,7 +1571,7 @@ async def test_delete_device_registry_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.DeleteDeviceRegistryRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1492,11 +1587,16 @@ async def test_delete_device_registry_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_device_registry_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1506,7 +1606,9 @@ def test_delete_device_registry_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_device_registry(name="name_value",) + client.delete_device_registry( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1518,13 +1620,16 @@ def test_delete_device_registry_flattened(): def test_delete_device_registry_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_device_registry( - device_manager.DeleteDeviceRegistryRequest(), name="name_value", + device_manager.DeleteDeviceRegistryRequest(), + name="name_value", ) @@ -1544,7 +1649,9 @@ async def test_delete_device_registry_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_device_registry(name="name_value",) + response = await client.delete_device_registry( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1565,16 +1672,22 @@ async def test_delete_device_registry_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_device_registry( - device_manager.DeleteDeviceRegistryRequest(), name="name_value", + device_manager.DeleteDeviceRegistryRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [device_manager.ListDeviceRegistriesRequest, dict,] + "request_type", + [ + device_manager.ListDeviceRegistriesRequest, + dict, + ], ) def test_list_device_registries(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1605,7 +1718,8 @@ def test_list_device_registries_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1624,7 +1738,8 @@ async def test_list_device_registries_async( request_type=device_manager.ListDeviceRegistriesRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1659,13 +1774,15 @@ async def test_list_device_registries_async_from_dict(): def test_list_device_registries_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.ListDeviceRegistriesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1681,7 +1798,10 @@ def test_list_device_registries_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1694,7 +1814,7 @@ async def test_list_device_registries_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.ListDeviceRegistriesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1712,11 +1832,16 @@ async def test_list_device_registries_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_device_registries_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1726,7 +1851,9 @@ def test_list_device_registries_flattened(): call.return_value = device_manager.ListDeviceRegistriesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_device_registries(parent="parent_value",) + client.list_device_registries( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1738,13 +1865,16 @@ def test_list_device_registries_flattened(): def test_list_device_registries_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_device_registries( - device_manager.ListDeviceRegistriesRequest(), parent="parent_value", + device_manager.ListDeviceRegistriesRequest(), + parent="parent_value", ) @@ -1766,7 +1896,9 @@ async def test_list_device_registries_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_device_registries(parent="parent_value",) + response = await client.list_device_registries( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1787,13 +1919,15 @@ async def test_list_device_registries_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_device_registries( - device_manager.ListDeviceRegistriesRequest(), parent="parent_value", + device_manager.ListDeviceRegistriesRequest(), + parent="parent_value", ) def test_list_device_registries_pager(transport_name: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1811,10 +1945,14 @@ def test_list_device_registries_pager(transport_name: str = "grpc"): next_page_token="abc", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[], next_page_token="def", + device_registries=[], + next_page_token="def", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[resources.DeviceRegistry(),], next_page_token="ghi", + device_registries=[ + resources.DeviceRegistry(), + ], + next_page_token="ghi", ), device_manager.ListDeviceRegistriesResponse( device_registries=[ @@ -1833,14 +1971,15 @@ def test_list_device_registries_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, resources.DeviceRegistry) for i in results) def test_list_device_registries_pages(transport_name: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1858,10 +1997,14 @@ def test_list_device_registries_pages(transport_name: str = "grpc"): next_page_token="abc", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[], next_page_token="def", + device_registries=[], + next_page_token="def", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[resources.DeviceRegistry(),], next_page_token="ghi", + device_registries=[ + resources.DeviceRegistry(), + ], + next_page_token="ghi", ), device_manager.ListDeviceRegistriesResponse( device_registries=[ @@ -1878,7 +2021,9 @@ def test_list_device_registries_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_device_registries_async_pager(): - client = DeviceManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeviceManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1897,10 +2042,14 @@ async def test_list_device_registries_async_pager(): next_page_token="abc", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[], next_page_token="def", + device_registries=[], + next_page_token="def", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[resources.DeviceRegistry(),], next_page_token="ghi", + device_registries=[ + resources.DeviceRegistry(), + ], + next_page_token="ghi", ), device_manager.ListDeviceRegistriesResponse( device_registries=[ @@ -1910,10 +2059,12 @@ async def test_list_device_registries_async_pager(): ), RuntimeError, ) - async_pager = await client.list_device_registries(request={},) + async_pager = await client.list_device_registries( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1922,7 +2073,9 @@ async def test_list_device_registries_async_pager(): @pytest.mark.asyncio async def test_list_device_registries_async_pages(): - client = DeviceManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeviceManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1941,10 +2094,14 @@ async def test_list_device_registries_async_pages(): next_page_token="abc", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[], next_page_token="def", + device_registries=[], + next_page_token="def", ), device_manager.ListDeviceRegistriesResponse( - device_registries=[resources.DeviceRegistry(),], next_page_token="ghi", + device_registries=[ + resources.DeviceRegistry(), + ], + next_page_token="ghi", ), device_manager.ListDeviceRegistriesResponse( device_registries=[ @@ -1955,16 +2112,25 @@ async def test_list_device_registries_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_device_registries(request={})).pages: + async for page_ in ( + await client.list_device_registries(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token -@pytest.mark.parametrize("request_type", [device_manager.CreateDeviceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + device_manager.CreateDeviceRequest, + dict, + ], +) def test_create_device(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2001,7 +2167,8 @@ def test_create_device_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2017,7 +2184,8 @@ async def test_create_device_async( transport: str = "grpc_asyncio", request_type=device_manager.CreateDeviceRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2058,13 +2226,15 @@ async def test_create_device_async_from_dict(): def test_create_device_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.CreateDeviceRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_device), "__call__") as call: @@ -2078,7 +2248,10 @@ def test_create_device_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2091,7 +2264,7 @@ async def test_create_device_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.CreateDeviceRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_device), "__call__") as call: @@ -2105,11 +2278,16 @@ async def test_create_device_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_device_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_device), "__call__") as call: @@ -2118,7 +2296,8 @@ def test_create_device_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_device( - parent="parent_value", device=resources.Device(id="id_value"), + parent="parent_value", + device=resources.Device(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -2134,7 +2313,9 @@ def test_create_device_flattened(): def test_create_device_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2161,7 +2342,8 @@ async def test_create_device_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_device( - parent="parent_value", device=resources.Device(id="id_value"), + parent="parent_value", + device=resources.Device(id="id_value"), ) # Establish that the underlying call was made with the expected @@ -2192,10 +2374,17 @@ async def test_create_device_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [device_manager.GetDeviceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + device_manager.GetDeviceRequest, + dict, + ], +) def test_get_device(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2232,7 +2421,8 @@ def test_get_device_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2248,7 +2438,8 @@ async def test_get_device_async( transport: str = "grpc_asyncio", request_type=device_manager.GetDeviceRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2289,13 +2480,15 @@ async def test_get_device_async_from_dict(): def test_get_device_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.GetDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_device), "__call__") as call: @@ -2309,7 +2502,10 @@ def test_get_device_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2322,7 +2518,7 @@ async def test_get_device_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.GetDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_device), "__call__") as call: @@ -2336,11 +2532,16 @@ async def test_get_device_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_device_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_device), "__call__") as call: @@ -2348,7 +2549,9 @@ def test_get_device_flattened(): call.return_value = resources.Device() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_device(name="name_value",) + client.get_device( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2360,13 +2563,16 @@ def test_get_device_flattened(): def test_get_device_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_device( - device_manager.GetDeviceRequest(), name="name_value", + device_manager.GetDeviceRequest(), + name="name_value", ) @@ -2384,7 +2590,9 @@ async def test_get_device_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.Device()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_device(name="name_value",) + response = await client.get_device( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2405,14 +2613,22 @@ async def test_get_device_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_device( - device_manager.GetDeviceRequest(), name="name_value", + device_manager.GetDeviceRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [device_manager.UpdateDeviceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + device_manager.UpdateDeviceRequest, + dict, + ], +) def test_update_device(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2449,7 +2665,8 @@ def test_update_device_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2465,7 +2682,8 @@ async def test_update_device_async( transport: str = "grpc_asyncio", request_type=device_manager.UpdateDeviceRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2506,13 +2724,15 @@ async def test_update_device_async_from_dict(): def test_update_device_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.UpdateDeviceRequest() - request.device.name = "device.name/value" + request.device.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_device), "__call__") as call: @@ -2526,7 +2746,10 @@ def test_update_device_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "device.name=device.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "device.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2539,7 +2762,7 @@ async def test_update_device_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.UpdateDeviceRequest() - request.device.name = "device.name/value" + request.device.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_device), "__call__") as call: @@ -2553,11 +2776,16 @@ async def test_update_device_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "device.name=device.name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "device.name=name_value", + ) in kw["metadata"] def test_update_device_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_device), "__call__") as call: @@ -2583,7 +2811,9 @@ def test_update_device_flattened(): def test_update_device_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2642,10 +2872,17 @@ async def test_update_device_flattened_error_async(): ) -@pytest.mark.parametrize("request_type", [device_manager.DeleteDeviceRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + device_manager.DeleteDeviceRequest, + dict, + ], +) def test_delete_device(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2671,7 +2908,8 @@ def test_delete_device_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2687,7 +2925,8 @@ async def test_delete_device_async( transport: str = "grpc_asyncio", request_type=device_manager.DeleteDeviceRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2715,13 +2954,15 @@ async def test_delete_device_async_from_dict(): def test_delete_device_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.DeleteDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_device), "__call__") as call: @@ -2735,7 +2976,10 @@ def test_delete_device_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2748,7 +2992,7 @@ async def test_delete_device_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.DeleteDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_device), "__call__") as call: @@ -2762,11 +3006,16 @@ async def test_delete_device_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_device_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_device), "__call__") as call: @@ -2774,7 +3023,9 @@ def test_delete_device_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_device(name="name_value",) + client.delete_device( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2786,13 +3037,16 @@ def test_delete_device_flattened(): def test_delete_device_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_device( - device_manager.DeleteDeviceRequest(), name="name_value", + device_manager.DeleteDeviceRequest(), + name="name_value", ) @@ -2810,7 +3064,9 @@ async def test_delete_device_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_device(name="name_value",) + response = await client.delete_device( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2831,14 +3087,22 @@ async def test_delete_device_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_device( - device_manager.DeleteDeviceRequest(), name="name_value", + device_manager.DeleteDeviceRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [device_manager.ListDevicesRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + device_manager.ListDevicesRequest, + dict, + ], +) def test_list_devices(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2867,7 +3131,8 @@ def test_list_devices_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2883,7 +3148,8 @@ async def test_list_devices_async( transport: str = "grpc_asyncio", request_type=device_manager.ListDevicesRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2894,7 +3160,9 @@ async def test_list_devices_async( with mock.patch.object(type(client.transport.list_devices), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - device_manager.ListDevicesResponse(next_page_token="next_page_token_value",) + device_manager.ListDevicesResponse( + next_page_token="next_page_token_value", + ) ) response = await client.list_devices(request) @@ -2914,13 +3182,15 @@ async def test_list_devices_async_from_dict(): def test_list_devices_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.ListDevicesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_devices), "__call__") as call: @@ -2934,7 +3204,10 @@ def test_list_devices_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2947,7 +3220,7 @@ async def test_list_devices_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.ListDevicesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_devices), "__call__") as call: @@ -2963,11 +3236,16 @@ async def test_list_devices_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_devices_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_devices), "__call__") as call: @@ -2975,7 +3253,9 @@ def test_list_devices_flattened(): call.return_value = device_manager.ListDevicesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_devices(parent="parent_value",) + client.list_devices( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2987,13 +3267,16 @@ def test_list_devices_flattened(): def test_list_devices_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_devices( - device_manager.ListDevicesRequest(), parent="parent_value", + device_manager.ListDevicesRequest(), + parent="parent_value", ) @@ -3013,7 +3296,9 @@ async def test_list_devices_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_devices(parent="parent_value",) + response = await client.list_devices( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3034,13 +3319,15 @@ async def test_list_devices_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_devices( - device_manager.ListDevicesRequest(), parent="parent_value", + device_manager.ListDevicesRequest(), + parent="parent_value", ) def test_list_devices_pager(transport_name: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3048,15 +3335,28 @@ def test_list_devices_pager(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + resources.Device(), + resources.Device(), + ], next_page_token="abc", ), - device_manager.ListDevicesResponse(devices=[], next_page_token="def",), device_manager.ListDevicesResponse( - devices=[resources.Device(),], next_page_token="ghi", + devices=[], + next_page_token="def", ), device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + ], + next_page_token="ghi", + ), + device_manager.ListDevicesResponse( + devices=[ + resources.Device(), + resources.Device(), + ], ), RuntimeError, ) @@ -3069,14 +3369,15 @@ def test_list_devices_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, resources.Device) for i in results) def test_list_devices_pages(transport_name: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3084,15 +3385,28 @@ def test_list_devices_pages(transport_name: str = "grpc"): # Set the response to a series of pages. call.side_effect = ( device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + resources.Device(), + resources.Device(), + ], next_page_token="abc", ), - device_manager.ListDevicesResponse(devices=[], next_page_token="def",), device_manager.ListDevicesResponse( - devices=[resources.Device(),], next_page_token="ghi", + devices=[], + next_page_token="def", + ), + device_manager.ListDevicesResponse( + devices=[ + resources.Device(), + ], + next_page_token="ghi", ), device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + resources.Device(), + ], ), RuntimeError, ) @@ -3103,7 +3417,9 @@ def test_list_devices_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_devices_async_pager(): - client = DeviceManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeviceManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3112,22 +3428,37 @@ async def test_list_devices_async_pager(): # Set the response to a series of pages. call.side_effect = ( device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + resources.Device(), + resources.Device(), + ], next_page_token="abc", ), - device_manager.ListDevicesResponse(devices=[], next_page_token="def",), device_manager.ListDevicesResponse( - devices=[resources.Device(),], next_page_token="ghi", + devices=[], + next_page_token="def", ), device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + ], + next_page_token="ghi", + ), + device_manager.ListDevicesResponse( + devices=[ + resources.Device(), + resources.Device(), + ], ), RuntimeError, ) - async_pager = await client.list_devices(request={},) + async_pager = await client.list_devices( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -3136,7 +3467,9 @@ async def test_list_devices_async_pager(): @pytest.mark.asyncio async def test_list_devices_async_pages(): - client = DeviceManagerAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = DeviceManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3145,31 +3478,51 @@ async def test_list_devices_async_pages(): # Set the response to a series of pages. call.side_effect = ( device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + resources.Device(), + resources.Device(), + ], next_page_token="abc", ), - device_manager.ListDevicesResponse(devices=[], next_page_token="def",), device_manager.ListDevicesResponse( - devices=[resources.Device(),], next_page_token="ghi", + devices=[], + next_page_token="def", ), device_manager.ListDevicesResponse( - devices=[resources.Device(), resources.Device(),], + devices=[ + resources.Device(), + ], + next_page_token="ghi", + ), + device_manager.ListDevicesResponse( + devices=[ + resources.Device(), + resources.Device(), + ], ), RuntimeError, ) pages = [] - async for page_ in (await client.list_devices(request={})).pages: + async for page_ in ( + await client.list_devices(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [device_manager.ModifyCloudToDeviceConfigRequest, dict,] + "request_type", + [ + device_manager.ModifyCloudToDeviceConfigRequest, + dict, + ], ) def test_modify_cloud_to_device_config(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3182,7 +3535,8 @@ def test_modify_cloud_to_device_config(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = resources.DeviceConfig( - version=774, binary_data=b"binary_data_blob", + version=774, + binary_data=b"binary_data_blob", ) response = client.modify_cloud_to_device_config(request) @@ -3201,7 +3555,8 @@ def test_modify_cloud_to_device_config_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3220,7 +3575,8 @@ async def test_modify_cloud_to_device_config_async( request_type=device_manager.ModifyCloudToDeviceConfigRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3233,7 +3589,10 @@ async def test_modify_cloud_to_device_config_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DeviceConfig(version=774, binary_data=b"binary_data_blob",) + resources.DeviceConfig( + version=774, + binary_data=b"binary_data_blob", + ) ) response = await client.modify_cloud_to_device_config(request) @@ -3254,13 +3613,15 @@ async def test_modify_cloud_to_device_config_async_from_dict(): def test_modify_cloud_to_device_config_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.ModifyCloudToDeviceConfigRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3276,7 +3637,10 @@ def test_modify_cloud_to_device_config_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3289,7 +3653,7 @@ async def test_modify_cloud_to_device_config_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.ModifyCloudToDeviceConfigRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3307,11 +3671,16 @@ async def test_modify_cloud_to_device_config_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_modify_cloud_to_device_config_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3322,7 +3691,8 @@ def test_modify_cloud_to_device_config_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.modify_cloud_to_device_config( - name="name_value", binary_data=b"binary_data_blob", + name="name_value", + binary_data=b"binary_data_blob", ) # Establish that the underlying call was made with the expected @@ -3338,7 +3708,9 @@ def test_modify_cloud_to_device_config_flattened(): def test_modify_cloud_to_device_config_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3369,7 +3741,8 @@ async def test_modify_cloud_to_device_config_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.modify_cloud_to_device_config( - name="name_value", binary_data=b"binary_data_blob", + name="name_value", + binary_data=b"binary_data_blob", ) # Establish that the underlying call was made with the expected @@ -3401,11 +3774,16 @@ async def test_modify_cloud_to_device_config_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.ListDeviceConfigVersionsRequest, dict,] + "request_type", + [ + device_manager.ListDeviceConfigVersionsRequest, + dict, + ], ) def test_list_device_config_versions(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3433,7 +3811,8 @@ def test_list_device_config_versions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3452,7 +3831,8 @@ async def test_list_device_config_versions_async( request_type=device_manager.ListDeviceConfigVersionsRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3484,13 +3864,15 @@ async def test_list_device_config_versions_async_from_dict(): def test_list_device_config_versions_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.ListDeviceConfigVersionsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3506,7 +3888,10 @@ def test_list_device_config_versions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3519,7 +3904,7 @@ async def test_list_device_config_versions_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.ListDeviceConfigVersionsRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3537,11 +3922,16 @@ async def test_list_device_config_versions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_list_device_config_versions_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3551,7 +3941,9 @@ def test_list_device_config_versions_flattened(): call.return_value = device_manager.ListDeviceConfigVersionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_device_config_versions(name="name_value",) + client.list_device_config_versions( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3563,13 +3955,16 @@ def test_list_device_config_versions_flattened(): def test_list_device_config_versions_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_device_config_versions( - device_manager.ListDeviceConfigVersionsRequest(), name="name_value", + device_manager.ListDeviceConfigVersionsRequest(), + name="name_value", ) @@ -3591,7 +3986,9 @@ async def test_list_device_config_versions_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_device_config_versions(name="name_value",) + response = await client.list_device_config_versions( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3612,16 +4009,22 @@ async def test_list_device_config_versions_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_device_config_versions( - device_manager.ListDeviceConfigVersionsRequest(), name="name_value", + device_manager.ListDeviceConfigVersionsRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [device_manager.ListDeviceStatesRequest, dict,] + "request_type", + [ + device_manager.ListDeviceStatesRequest, + dict, + ], ) def test_list_device_states(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3649,7 +4052,8 @@ def test_list_device_states_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3667,7 +4071,8 @@ async def test_list_device_states_async( transport: str = "grpc_asyncio", request_type=device_manager.ListDeviceStatesRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3699,13 +4104,15 @@ async def test_list_device_states_async_from_dict(): def test_list_device_states_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.ListDeviceStatesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3721,7 +4128,10 @@ def test_list_device_states_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3734,7 +4144,7 @@ async def test_list_device_states_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.ListDeviceStatesRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3752,11 +4162,16 @@ async def test_list_device_states_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_list_device_states_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3766,7 +4181,9 @@ def test_list_device_states_flattened(): call.return_value = device_manager.ListDeviceStatesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_device_states(name="name_value",) + client.list_device_states( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3778,13 +4195,16 @@ def test_list_device_states_flattened(): def test_list_device_states_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_device_states( - device_manager.ListDeviceStatesRequest(), name="name_value", + device_manager.ListDeviceStatesRequest(), + name="name_value", ) @@ -3806,7 +4226,9 @@ async def test_list_device_states_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_device_states(name="name_value",) + response = await client.list_device_states( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3827,14 +4249,22 @@ async def test_list_device_states_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_device_states( - device_manager.ListDeviceStatesRequest(), name="name_value", + device_manager.ListDeviceStatesRequest(), + name="name_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.SetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.SetIamPolicyRequest, + dict, + ], +) def test_set_iam_policy(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3844,7 +4274,10 @@ def test_set_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.set_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -3862,7 +4295,8 @@ def test_set_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3878,7 +4312,8 @@ async def test_set_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.SetIamPolicyRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3889,7 +4324,10 @@ async def test_set_iam_policy_async( with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.set_iam_policy(request) @@ -3910,13 +4348,15 @@ async def test_set_iam_policy_async_from_dict(): def test_set_iam_policy_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3930,7 +4370,10 @@ def test_set_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3943,7 +4386,7 @@ async def test_set_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.SetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3957,11 +4400,16 @@ async def test_set_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_set_iam_policy_from_dict_foreign(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -3970,13 +4418,16 @@ def test_set_iam_policy_from_dict_foreign(): request={ "resource": "resource_value", "policy": policy_pb2.Policy(version=774), + "update_mask": field_mask_pb2.FieldMask(paths=["paths_value"]), } ) call.assert_called() def test_set_iam_policy_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.set_iam_policy), "__call__") as call: @@ -3984,7 +4435,9 @@ def test_set_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.set_iam_policy(resource="resource_value",) + client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3996,13 +4449,16 @@ def test_set_iam_policy_flattened(): def test_set_iam_policy_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) @@ -4020,7 +4476,9 @@ async def test_set_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.set_iam_policy(resource="resource_value",) + response = await client.set_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4041,14 +4499,22 @@ async def test_set_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.set_iam_policy( - iam_policy_pb2.SetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.SetIamPolicyRequest(), + resource="resource_value", ) -@pytest.mark.parametrize("request_type", [iam_policy_pb2.GetIamPolicyRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + iam_policy_pb2.GetIamPolicyRequest, + dict, + ], +) def test_get_iam_policy(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4058,7 +4524,10 @@ def test_get_iam_policy(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = policy_pb2.Policy(version=774, etag=b"etag_blob",) + call.return_value = policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) response = client.get_iam_policy(request) # Establish that the underlying gRPC stub method was called. @@ -4076,7 +4545,8 @@ def test_get_iam_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4092,7 +4562,8 @@ async def test_get_iam_policy_async( transport: str = "grpc_asyncio", request_type=iam_policy_pb2.GetIamPolicyRequest ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4103,7 +4574,10 @@ async def test_get_iam_policy_async( with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - policy_pb2.Policy(version=774, etag=b"etag_blob",) + policy_pb2.Policy( + version=774, + etag=b"etag_blob", + ) ) response = await client.get_iam_policy(request) @@ -4124,13 +4598,15 @@ async def test_get_iam_policy_async_from_dict(): def test_get_iam_policy_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4144,7 +4620,10 @@ def test_get_iam_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4157,7 +4636,7 @@ async def test_get_iam_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.GetIamPolicyRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4171,11 +4650,16 @@ async def test_get_iam_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_get_iam_policy_from_dict_foreign(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: # Designate an appropriate return value for the call. @@ -4190,7 +4674,9 @@ def test_get_iam_policy_from_dict_foreign(): def test_get_iam_policy_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_iam_policy), "__call__") as call: @@ -4198,7 +4684,9 @@ def test_get_iam_policy_flattened(): call.return_value = policy_pb2.Policy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_iam_policy(resource="resource_value",) + client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4210,13 +4698,16 @@ def test_get_iam_policy_flattened(): def test_get_iam_policy_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) @@ -4234,7 +4725,9 @@ async def test_get_iam_policy_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(policy_pb2.Policy()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_iam_policy(resource="resource_value",) + response = await client.get_iam_policy( + resource="resource_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4255,16 +4748,22 @@ async def test_get_iam_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_iam_policy( - iam_policy_pb2.GetIamPolicyRequest(), resource="resource_value", + iam_policy_pb2.GetIamPolicyRequest(), + resource="resource_value", ) @pytest.mark.parametrize( - "request_type", [iam_policy_pb2.TestIamPermissionsRequest, dict,] + "request_type", + [ + iam_policy_pb2.TestIamPermissionsRequest, + dict, + ], ) def test_test_iam_permissions(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4295,7 +4794,8 @@ def test_test_iam_permissions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4314,7 +4814,8 @@ async def test_test_iam_permissions_async( request_type=iam_policy_pb2.TestIamPermissionsRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4349,13 +4850,15 @@ async def test_test_iam_permissions_async_from_dict(): def test_test_iam_permissions_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4371,7 +4874,10 @@ def test_test_iam_permissions_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4384,7 +4890,7 @@ async def test_test_iam_permissions_field_headers_async(): # a field header. Set these to a non-empty value. request = iam_policy_pb2.TestIamPermissionsRequest() - request.resource = "resource/value" + request.resource = "resource_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4402,11 +4908,16 @@ async def test_test_iam_permissions_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "resource=resource/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "resource=resource_value", + ) in kw["metadata"] def test_test_iam_permissions_from_dict_foreign(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( type(client.transport.test_iam_permissions), "__call__" @@ -4423,7 +4934,9 @@ def test_test_iam_permissions_from_dict_foreign(): def test_test_iam_permissions_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4434,7 +4947,8 @@ def test_test_iam_permissions_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -4450,7 +4964,9 @@ def test_test_iam_permissions_flattened(): def test_test_iam_permissions_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4481,7 +4997,8 @@ async def test_test_iam_permissions_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.test_iam_permissions( - resource="resource_value", permissions=["permissions_value"], + resource="resource_value", + permissions=["permissions_value"], ) # Establish that the underlying call was made with the expected @@ -4513,11 +5030,16 @@ async def test_test_iam_permissions_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.SendCommandToDeviceRequest, dict,] + "request_type", + [ + device_manager.SendCommandToDeviceRequest, + dict, + ], ) def test_send_command_to_device(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4545,7 +5067,8 @@ def test_send_command_to_device_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4564,7 +5087,8 @@ async def test_send_command_to_device_async( request_type=device_manager.SendCommandToDeviceRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4596,13 +5120,15 @@ async def test_send_command_to_device_async_from_dict(): def test_send_command_to_device_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.SendCommandToDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4618,7 +5144,10 @@ def test_send_command_to_device_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4631,7 +5160,7 @@ async def test_send_command_to_device_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.SendCommandToDeviceRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4649,11 +5178,16 @@ async def test_send_command_to_device_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_send_command_to_device_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4685,7 +5219,9 @@ def test_send_command_to_device_flattened(): def test_send_command_to_device_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4755,11 +5291,16 @@ async def test_send_command_to_device_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.BindDeviceToGatewayRequest, dict,] + "request_type", + [ + device_manager.BindDeviceToGatewayRequest, + dict, + ], ) def test_bind_device_to_gateway(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4787,7 +5328,8 @@ def test_bind_device_to_gateway_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4806,7 +5348,8 @@ async def test_bind_device_to_gateway_async( request_type=device_manager.BindDeviceToGatewayRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4838,13 +5381,15 @@ async def test_bind_device_to_gateway_async_from_dict(): def test_bind_device_to_gateway_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.BindDeviceToGatewayRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4860,7 +5405,10 @@ def test_bind_device_to_gateway_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4873,7 +5421,7 @@ async def test_bind_device_to_gateway_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.BindDeviceToGatewayRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4891,11 +5439,16 @@ async def test_bind_device_to_gateway_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_bind_device_to_gateway_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4927,7 +5480,9 @@ def test_bind_device_to_gateway_flattened(): def test_bind_device_to_gateway_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4997,11 +5552,16 @@ async def test_bind_device_to_gateway_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [device_manager.UnbindDeviceFromGatewayRequest, dict,] + "request_type", + [ + device_manager.UnbindDeviceFromGatewayRequest, + dict, + ], ) def test_unbind_device_from_gateway(request_type, transport: str = "grpc"): client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5029,7 +5589,8 @@ def test_unbind_device_from_gateway_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5048,7 +5609,8 @@ async def test_unbind_device_from_gateway_async( request_type=device_manager.UnbindDeviceFromGatewayRequest, ): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5080,13 +5642,15 @@ async def test_unbind_device_from_gateway_async_from_dict(): def test_unbind_device_from_gateway_field_headers(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = device_manager.UnbindDeviceFromGatewayRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5102,7 +5666,10 @@ def test_unbind_device_from_gateway_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5115,7 +5682,7 @@ async def test_unbind_device_from_gateway_field_headers_async(): # a field header. Set these to a non-empty value. request = device_manager.UnbindDeviceFromGatewayRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5133,11 +5700,16 @@ async def test_unbind_device_from_gateway_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_unbind_device_from_gateway_flattened(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5169,7 +5741,9 @@ def test_unbind_device_from_gateway_flattened(): def test_unbind_device_from_gateway_flattened_error(): - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5245,7 +5819,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeviceManagerClient( - 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. @@ -5265,7 +5840,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = DeviceManagerClient(client_options=options, transport=transport,) + client = DeviceManagerClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5281,7 +5859,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = DeviceManagerClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5324,10 +5903,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = DeviceManagerClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = DeviceManagerClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.DeviceManagerGrpcTransport,) + client = DeviceManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.DeviceManagerGrpcTransport, + ) def test_device_manager_base_transport_error(): @@ -5379,6 +5976,14 @@ def test_device_manager_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_device_manager_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -5390,7 +5995,8 @@ def test_device_manager_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.DeviceManagerTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5535,24 +6141,40 @@ def test_device_manager_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_device_manager_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_device_manager_host_no_port(transport_name): client = DeviceManagerClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudiot.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "cloudiot.googleapis.com:443" + assert client.transport._host == ("cloudiot.googleapis.com:443") -def test_device_manager_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_device_manager_host_with_port(transport_name): client = DeviceManagerClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="cloudiot.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "cloudiot.googleapis.com:8000" + assert client.transport._host == ("cloudiot.googleapis.com:8000") def test_device_manager_grpc_transport_channel(): @@ -5560,7 +6182,8 @@ def test_device_manager_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.DeviceManagerGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5572,7 +6195,8 @@ def test_device_manager_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.DeviceManagerGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5683,7 +6307,10 @@ def test_device_path(): registry = "whelk" device = "octopus" expected = "projects/{project}/locations/{location}/registries/{registry}/devices/{device}".format( - project=project, location=location, registry=registry, device=device, + project=project, + location=location, + registry=registry, + device=device, ) actual = DeviceManagerClient.device_path(project, location, registry, device) assert expected == actual @@ -5708,7 +6335,9 @@ def test_registry_path(): location = "nautilus" registry = "scallop" expected = "projects/{project}/locations/{location}/registries/{registry}".format( - project=project, location=location, registry=registry, + project=project, + location=location, + registry=registry, ) actual = DeviceManagerClient.registry_path(project, location, registry) assert expected == actual @@ -5749,7 +6378,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "oyster" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = DeviceManagerClient.common_folder_path(folder) assert expected == actual @@ -5767,7 +6398,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "cuttlefish" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = DeviceManagerClient.common_organization_path(organization) assert expected == actual @@ -5785,7 +6418,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "winkle" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = DeviceManagerClient.common_project_path(project) assert expected == actual @@ -5805,7 +6440,8 @@ def test_common_location_path(): project = "scallop" location = "abalone" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = DeviceManagerClient.common_location_path(project, location) assert expected == actual @@ -5830,7 +6466,8 @@ def test_client_with_default_client_info(): transports.DeviceManagerTransport, "_prep_wrapped_messages" ) as prep: client = DeviceManagerClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5839,7 +6476,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = DeviceManagerClient.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) @@ -5847,7 +6485,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = DeviceManagerAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"