Skip to content

Commit fc4d2bf

Browse files
committed
Making sure to use kwargs when calling GAPIC surfaces.
1 parent 63c206d commit fc4d2bf

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

logging/google/cloud/logging/_gax.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ def list_entries(self, projects, filter_='', order_by='',
7979
page_token = INITIAL_PAGE
8080
options = CallOptions(page_token=page_token)
8181
page_iter = self._gax_api.list_log_entries(
82-
projects, filter_, order_by, page_size, options)
82+
projects, filter_=filter_, order_by=order_by,
83+
page_size=page_size, options=options)
8384
entries = [_log_entry_pb_to_mapping(entry_pb)
8485
for entry_pb in page_iter.next()]
8586
token = page_iter.page_token or None
@@ -107,8 +108,9 @@ def write_entries(self, entries, logger_name=None, resource=None,
107108
options = None
108109
partial_success = False
109110
entry_pbs = [_log_entry_mapping_to_pb(entry) for entry in entries]
110-
self._gax_api.write_log_entries(entry_pbs, logger_name, resource,
111-
labels, partial_success, options)
111+
self._gax_api.write_log_entries(
112+
entry_pbs, log_name=logger_name, resource=resource, labels=labels,
113+
partial_success=partial_success, options=options)
112114

113115
def logger_delete(self, project, logger_name):
114116
"""API call: delete all entries in a logger via a DELETE request
@@ -122,7 +124,7 @@ def logger_delete(self, project, logger_name):
122124
options = None
123125
path = 'projects/%s/logs/%s' % (project, logger_name)
124126
try:
125-
self._gax_api.delete_log(path, options)
127+
self._gax_api.delete_log(path, options=options)
126128
except GaxError as exc:
127129
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
128130
raise NotFound(path)
@@ -163,7 +165,8 @@ def list_sinks(self, project, page_size=0, page_token=None):
163165
page_token = INITIAL_PAGE
164166
options = CallOptions(page_token=page_token)
165167
path = 'projects/%s' % (project,)
166-
page_iter = self._gax_api.list_sinks(path, page_size, options)
168+
page_iter = self._gax_api.list_sinks(path, page_size=page_size,
169+
options=options)
167170
sinks = [_log_sink_pb_to_mapping(log_sink_pb)
168171
for log_sink_pb in page_iter.next()]
169172
token = page_iter.page_token or None
@@ -194,7 +197,7 @@ def sink_create(self, project, sink_name, filter_, destination):
194197
sink_pb = LogSink(name=sink_name, filter=filter_,
195198
destination=destination)
196199
try:
197-
self._gax_api.create_sink(parent, sink_pb, options)
200+
self._gax_api.create_sink(parent, sink_pb, options=options)
198201
except GaxError as exc:
199202
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
200203
path = 'projects/%s/sinks/%s' % (project, sink_name)
@@ -217,7 +220,7 @@ def sink_get(self, project, sink_name):
217220
options = None
218221
path = 'projects/%s/sinks/%s' % (project, sink_name)
219222
try:
220-
sink_pb = self._gax_api.get_sink(path, options)
223+
sink_pb = self._gax_api.get_sink(path, options=options)
221224
except GaxError as exc:
222225
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
223226
raise NotFound(path)
@@ -249,7 +252,7 @@ def sink_update(self, project, sink_name, filter_, destination):
249252
path = 'projects/%s/sinks/%s' % (project, sink_name)
250253
sink_pb = LogSink(name=path, filter=filter_, destination=destination)
251254
try:
252-
self._gax_api.update_sink(path, sink_pb, options)
255+
self._gax_api.update_sink(path, sink_pb, options=options)
253256
except GaxError as exc:
254257
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
255258
raise NotFound(path)
@@ -268,7 +271,7 @@ def sink_delete(self, project, sink_name):
268271
options = None
269272
path = 'projects/%s/sinks/%s' % (project, sink_name)
270273
try:
271-
self._gax_api.delete_sink(path, options)
274+
self._gax_api.delete_sink(path, options=options)
272275
except GaxError as exc:
273276
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
274277
raise NotFound(path)
@@ -309,7 +312,8 @@ def list_metrics(self, project, page_size=0, page_token=None):
309312
page_token = INITIAL_PAGE
310313
options = CallOptions(page_token=page_token)
311314
path = 'projects/%s' % (project,)
312-
page_iter = self._gax_api.list_log_metrics(path, page_size, options)
315+
page_iter = self._gax_api.list_log_metrics(
316+
path, page_size=page_size, options=options)
313317
metrics = [_log_metric_pb_to_mapping(log_metric_pb)
314318
for log_metric_pb in page_iter.next()]
315319
token = page_iter.page_token or None
@@ -339,7 +343,7 @@ def metric_create(self, project, metric_name, filter_, description):
339343
metric_pb = LogMetric(name=metric_name, filter=filter_,
340344
description=description)
341345
try:
342-
self._gax_api.create_log_metric(parent, metric_pb, options)
346+
self._gax_api.create_log_metric(parent, metric_pb, options=options)
343347
except GaxError as exc:
344348
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
345349
path = 'projects/%s/metrics/%s' % (project, metric_name)
@@ -362,7 +366,7 @@ def metric_get(self, project, metric_name):
362366
options = None
363367
path = 'projects/%s/metrics/%s' % (project, metric_name)
364368
try:
365-
metric_pb = self._gax_api.get_log_metric(path, options)
369+
metric_pb = self._gax_api.get_log_metric(path, options=options)
366370
except GaxError as exc:
367371
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
368372
raise NotFound(path)
@@ -394,7 +398,7 @@ def metric_update(self, project, metric_name, filter_, description):
394398
metric_pb = LogMetric(name=path, filter=filter_,
395399
description=description)
396400
try:
397-
self._gax_api.update_log_metric(path, metric_pb, options)
401+
self._gax_api.update_log_metric(path, metric_pb, options=options)
398402
except GaxError as exc:
399403
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
400404
raise NotFound(path)
@@ -413,7 +417,7 @@ def metric_delete(self, project, metric_name):
413417
options = None
414418
path = 'projects/%s/metrics/%s' % (project, metric_name)
415419
try:
416-
self._gax_api.delete_log_metric(path, options)
420+
self._gax_api.delete_log_metric(path, options=options)
417421
except GaxError as exc:
418422
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
419423
raise NotFound(path)

pubsub/google/cloud/pubsub/_gax.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def subscription_create(self, subscription_path, topic_path,
293293

294294
try:
295295
sub_pb = self._gax_api.create_subscription(
296-
subscription_path, topic_path, push_config, ack_deadline)
296+
subscription_path, topic_path,
297+
push_config=push_config, ack_deadline_seconds=ack_deadline)
297298
except GaxError as exc:
298299
if exc_to_code(exc.cause) == StatusCode.FAILED_PRECONDITION:
299300
raise Conflict(topic_path)
@@ -391,7 +392,8 @@ def subscription_pull(self, subscription_path, return_immediately=False,
391392
"""
392393
try:
393394
response_pb = self._gax_api.pull(
394-
subscription_path, max_messages, return_immediately)
395+
subscription_path, max_messages,
396+
return_immediately=return_immediately)
395397
except GaxError as exc:
396398
if exc_to_code(exc.cause) == StatusCode.NOT_FOUND:
397399
raise NotFound(subscription_path)

0 commit comments

Comments
 (0)