Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Python: expose 'channel' as a property of the transport. #2396

Merged
merged 3 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/resources/com/google/api/codegen/py/transport.snip
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
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 @@ -92,6 +94,15 @@
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

# ----- RPC CALLS -----
@join apiMethod : api.apiMethods on BREAK.add(BREAK)
@@property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3527,6 +3527,8 @@ class LibraryServiceGrpcTransport(object):
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 @@ -3563,6 +3565,15 @@ class LibraryServiceGrpcTransport(object):
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_shelf(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,8 @@ class DecrementerServiceGrpcTransport(object):
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 @@ -1383,6 +1385,15 @@ class DecrementerServiceGrpcTransport(object):
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 decrement(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down Expand Up @@ -1461,6 +1472,8 @@ class IncrementerServiceGrpcTransport(object):
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 @@ -1492,6 +1505,15 @@ class IncrementerServiceGrpcTransport(object):
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 increment(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ class NoTemplatesApiServiceGrpcTransport(object):
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 @@ -1100,6 +1102,15 @@ class NoTemplatesApiServiceGrpcTransport(object):
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 increment(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down