Skip to content

Commit

Permalink
Logging: pick up fixes to GAPIC generator. (#6631)
Browse files Browse the repository at this point in the history
Includes fixes from these PRs:

- googleapis/gapic-generator#2407
- googleapis/gapic-generator#2396

Includes changes to generated tests.

Closes #6474.
  • Loading branch information
tseaver authored Nov 21, 2018
1 parent f550aba commit 463a21e
Show file tree
Hide file tree
Showing 10 changed files with 239 additions and 55 deletions.
17 changes: 12 additions & 5 deletions logging/google/cloud/logging_v2/gapic/config_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=config_service_v2_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -141,13 +141,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 = config_service_v2_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
17 changes: 12 additions & 5 deletions logging/google/cloud/logging_v2/gapic/logging_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=logging_service_v2_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -126,13 +126,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 = logging_service_v2_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
17 changes: 12 additions & 5 deletions logging/google/cloud/logging_v2/gapic/metrics_service_v2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __init__(self,
transport=None,
channel=None,
credentials=None,
client_config=metrics_service_v2_client_config.config,
client_config=None,
client_info=None):
"""Constructor.
Expand Down Expand Up @@ -131,13 +131,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 = metrics_service_v2_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 @@ -68,6 +68,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 @@ -98,6 +100,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 list_sinks(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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 @@ -98,6 +100,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 delete_log(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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 @@ -98,6 +100,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 list_log_metrics(self):
"""Return the gRPC stub for {$apiMethod.name}.
Expand Down
1 change: 1 addition & 0 deletions logging/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

s.move(library / 'google/cloud/logging_v2/proto')
s.move(library / 'google/cloud/logging_v2/gapic')
s.move(library / 'tests/unit/gapic/v2')

# Issues exist where python files should define the source encoding
# https://github.com/googleapis/gapic-generator/issues/2097
Expand Down
Loading

0 comments on commit 463a21e

Please sign in to comment.