Skip to content

Commit

Permalink
Pick up fixes to GAPIC generator. (googleapis#6513)
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver authored and Erik Webb committed Dec 3, 2018
1 parent 31c0fff commit a8eae64
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 37 deletions.
17 changes: 12 additions & 5 deletions iot/google/cloud/iot_v1/gapic/device_manager_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=device_manager_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -145,13 +145,20 @@ def __init__(self,
your own client library.
"""
# Raise deprecation warnings for things we want to go away.
if client_config:
warnings.warn('The `client_config` argument is deprecated.',
PendingDeprecationWarning)
if client_config is not None:
warnings.warn(
'The `client_config` argument is deprecated.',
PendingDeprecationWarning,
stacklevel=2)
else:
client_config = device_manager_client_config.config

if channel:
warnings.warn(
'The `channel` argument is deprecated; use '
'`transport` instead.', PendingDeprecationWarning)
'`transport` instead.',
PendingDeprecationWarning,
stacklevel=2)

# Instantiate the transport.
# The transport is responsible for handling serialization and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def __init__(self,
credentials=credentials,
)

self._channel = channel

# gRPC uses objects called "stubs" that are bound to the
# channel and provide a basic method for each RPC.
self._stubs = {
Expand Down Expand Up @@ -95,6 +97,15 @@ def create_channel(cls,
scopes=cls._OAUTH_SCOPES,
)

@property
def channel(self):
"""The gRPC channel used by the transport.
Returns:
grpc.Channel: A gRPC channel object.
"""
return self._channel

@property
def create_device_registry(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
2 changes: 2 additions & 0 deletions iot/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@
artman_output_name='iot-v1')

s.move(library / 'google/cloud/iot_v1')
s.move(library / 'tests/unit/gapic')
s.move(library / 'tests/system/gapic')
2 changes: 2 additions & 0 deletions iot/tests/system/gapic/v1/test_system_device_manager_v1.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Loading

0 comments on commit a8eae64

Please sign in to comment.