Skip to content

Commit a151715

Browse files
committed
Dropping usage of connection.credentials in logging.
1 parent 9ebef22 commit a151715

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

logging/google/cloud/logging/_gax.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ def make_gax_logging_api(client):
533533
:returns: A metrics API instance with the proper credentials.
534534
"""
535535
channel = make_secure_channel(
536-
client._connection.credentials, DEFAULT_USER_AGENT,
536+
client._credentials, DEFAULT_USER_AGENT,
537537
LoggingServiceV2Client.SERVICE_ADDRESS)
538538
generated = LoggingServiceV2Client(
539539
channel=channel, lib_name='gccl', lib_version=__version__)
@@ -550,7 +550,7 @@ def make_gax_metrics_api(client):
550550
:returns: A metrics API instance with the proper credentials.
551551
"""
552552
channel = make_secure_channel(
553-
client._connection.credentials, DEFAULT_USER_AGENT,
553+
client._credentials, DEFAULT_USER_AGENT,
554554
MetricsServiceV2Client.SERVICE_ADDRESS)
555555
generated = MetricsServiceV2Client(
556556
channel=channel, lib_name='gccl', lib_version=__version__)
@@ -567,7 +567,7 @@ def make_gax_sinks_api(client):
567567
:returns: A metrics API instance with the proper credentials.
568568
"""
569569
channel = make_secure_channel(
570-
client._connection.credentials, DEFAULT_USER_AGENT,
570+
client._credentials, DEFAULT_USER_AGENT,
571571
ConfigServiceV2Client.SERVICE_ADDRESS)
572572
generated = ConfigServiceV2Client(
573573
channel=channel, lib_name='gccl', lib_version=__version__)

logging/google/cloud/logging/handlers/transports/background_thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class BackgroundThreadTransport(Transport):
152152
def __init__(self, client, name):
153153
http = copy.deepcopy(client._http)
154154
self.client = client.__class__(
155-
client.project, client._connection.credentials, http)
155+
client.project, client._credentials, http)
156156
logger = self.client.logger(name)
157157
self.worker = _Worker(logger)
158158

logging/unit_tests/test__gax.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,8 +1113,7 @@ def test_it(self):
11131113
from google.cloud.logging._gax import DEFAULT_USER_AGENT
11141114

11151115
creds = object()
1116-
conn = mock.Mock(credentials=creds, spec=['credentials'])
1117-
client = mock.Mock(_connection=conn, spec=['_connection'])
1116+
client = mock.Mock(_credentials=creds, spec=['_credentials'])
11181117
channels = []
11191118
channel_args = []
11201119
generated_api_kwargs = []
@@ -1167,8 +1166,7 @@ def test_it(self):
11671166
from google.cloud.logging._gax import DEFAULT_USER_AGENT
11681167

11691168
creds = object()
1170-
conn = mock.Mock(credentials=creds, spec=['credentials'])
1171-
client = mock.Mock(_connection=conn, spec=['_connection'])
1169+
client = mock.Mock(_credentials=creds, spec=['_credentials'])
11721170
channels = []
11731171
channel_args = []
11741172
generated_api_kwargs = []
@@ -1221,8 +1219,7 @@ def test_it(self):
12211219
from google.cloud.logging._gax import DEFAULT_USER_AGENT
12221220

12231221
creds = object()
1224-
conn = mock.Mock(credentials=creds, spec=['credentials'])
1225-
client = mock.Mock(_connection=conn, spec=['_connection'])
1222+
client = mock.Mock(_credentials=creds, spec=['_credentials'])
12261223
channels = []
12271224
channel_args = []
12281225
generated_api_kwargs = []

0 commit comments

Comments
 (0)