Skip to content

Commit 7c73b58

Browse files
authored
Merge pull request googleapis#2795 from dhermes/update-gapic-0.14
Upgrading GAPIC deps to 0.14 series.
2 parents 40d77e3 + dc10367 commit 7c73b58

File tree

9 files changed

+95
-94
lines changed

9 files changed

+95
-94
lines changed

logging/google/cloud/logging/_gax.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616

1717
import functools
1818

19-
from google.cloud.gapic.logging.v2.config_service_v2_api import (
20-
ConfigServiceV2Api)
21-
from google.cloud.gapic.logging.v2.logging_service_v2_api import (
22-
LoggingServiceV2Api)
23-
from google.cloud.gapic.logging.v2.metrics_service_v2_api import (
24-
MetricsServiceV2Api)
19+
from google.cloud.gapic.logging.v2.config_service_v2_client import (
20+
ConfigServiceV2Client)
21+
from google.cloud.gapic.logging.v2.logging_service_v2_client import (
22+
LoggingServiceV2Client)
23+
from google.cloud.gapic.logging.v2.metrics_service_v2_client import (
24+
MetricsServiceV2Client)
2525
from google.gax import CallOptions
2626
from google.gax import INITIAL_PAGE
2727
from google.gax.errors import GaxError
2828
from google.gax.grpc import exc_to_code
29-
from google.logging.v2.logging_config_pb2 import LogSink
30-
from google.logging.v2.logging_metrics_pb2 import LogMetric
31-
from google.logging.v2.log_entry_pb2 import LogEntry
29+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
30+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
31+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
3232
from google.protobuf.json_format import MessageToDict
3333
from google.protobuf.json_format import ParseDict
3434
from grpc import StatusCode
@@ -48,7 +48,7 @@ class _LoggingAPI(object):
4848
"""Helper mapping logging-related APIs.
4949
5050
:type gax_api:
51-
:class:`google.logging.v2.logging_service_v2_api.LoggingServiceV2Api`
51+
:class:`.logging_service_v2_client.LoggingServiceV2Client`
5252
:param gax_api: API object used to make GAX requests.
5353
5454
:type client: :class:`~google.cloud.logging.client.Client`
@@ -92,7 +92,7 @@ def list_entries(self, projects, filter_='', order_by='',
9292
page_token = INITIAL_PAGE
9393
options = CallOptions(page_token=page_token)
9494
page_iter = self._gax_api.list_log_entries(
95-
projects, filter_=filter_, order_by=order_by,
95+
[], project_ids=projects, filter_=filter_, order_by=order_by,
9696
page_size=page_size, options=options)
9797

9898
# We attach a mutable loggers dictionary so that as Logger
@@ -152,7 +152,7 @@ class _SinksAPI(object):
152152
"""Helper mapping sink-related APIs.
153153
154154
:type gax_api:
155-
:class:`google.logging.v2.config_service_v2_api.ConfigServiceV2Api`
155+
:class:`.config_service_v2_client.ConfigServiceV2Client`
156156
:param gax_api: API object used to make GAX requests.
157157
158158
:type client: :class:`~google.cloud.logging.client.Client`
@@ -300,7 +300,8 @@ class _MetricsAPI(object):
300300
"""Helper mapping sink-related APIs.
301301
302302
:type gax_api:
303-
:class:`google.logging.v2.metrics_service_v2_api.MetricsServiceV2Api`
303+
:class:`.metrics_service_v2_client.MetricsServiceV2Client`
304+
304305
:param gax_api: API object used to make GAX requests.
305306
306307
:type client: :class:`~google.cloud.logging.client.Client`
@@ -471,7 +472,7 @@ def _item_to_entry(iterator, entry_pb, loggers):
471472
:type iterator: :class:`~google.cloud.iterator.Iterator`
472473
:param iterator: The iterator that is currently in use.
473474
474-
:type entry_pb: :class:`~google.logging.v2.log_entry_pb2.LogEntry`
475+
:type entry_pb: :class:`.log_entry_pb2.LogEntry`
475476
:param entry_pb: Log entry protobuf returned from the API.
476477
477478
:type loggers: dict
@@ -494,7 +495,7 @@ def _item_to_sink(iterator, log_sink_pb):
494495
:param iterator: The iterator that is currently in use.
495496
496497
:type log_sink_pb:
497-
:class:`~google.logging.v2.logging_config_pb2.LogSink`
498+
:class:`.logging_config_pb2.LogSink`
498499
:param log_sink_pb: Sink protobuf returned from the API.
499500
500501
:rtype: :class:`~google.cloud.logging.sink.Sink`
@@ -511,7 +512,7 @@ def _item_to_metric(iterator, log_metric_pb):
511512
:param iterator: The iterator that is currently in use.
512513
513514
:type log_metric_pb:
514-
:class:`~google.logging.v2.logging_metrics_pb2.LogMetric`
515+
:class:`.logging_metrics_pb2.LogMetric`
515516
:param log_metric_pb: Metric protobuf returned from the API.
516517
517518
:rtype: :class:`~google.cloud.logging.metric.Metric`
@@ -532,8 +533,8 @@ def make_gax_logging_api(client):
532533
"""
533534
channel = make_secure_channel(
534535
client._connection.credentials, DEFAULT_USER_AGENT,
535-
LoggingServiceV2Api.SERVICE_ADDRESS)
536-
generated = LoggingServiceV2Api(channel=channel)
536+
LoggingServiceV2Client.SERVICE_ADDRESS)
537+
generated = LoggingServiceV2Client(channel=channel)
537538
return _LoggingAPI(generated, client)
538539

539540

@@ -548,8 +549,8 @@ def make_gax_metrics_api(client):
548549
"""
549550
channel = make_secure_channel(
550551
client._connection.credentials, DEFAULT_USER_AGENT,
551-
MetricsServiceV2Api.SERVICE_ADDRESS)
552-
generated = MetricsServiceV2Api(channel=channel)
552+
MetricsServiceV2Client.SERVICE_ADDRESS)
553+
generated = MetricsServiceV2Client(channel=channel)
553554
return _MetricsAPI(generated, client)
554555

555556

@@ -564,6 +565,6 @@ def make_gax_sinks_api(client):
564565
"""
565566
channel = make_secure_channel(
566567
client._connection.credentials, DEFAULT_USER_AGENT,
567-
ConfigServiceV2Api.SERVICE_ADDRESS)
568-
generated = ConfigServiceV2Api(channel=channel)
568+
ConfigServiceV2Client.SERVICE_ADDRESS)
569+
generated = ConfigServiceV2Client(channel=channel)
569570
return _SinksAPI(generated, client)

logging/setup.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@
5151

5252
REQUIREMENTS = [
5353
'google-cloud-core >= 0.21.0, < 0.22dev',
54-
'grpcio >= 1.0.0, < 2.0dev',
55-
'google-gax >= 0.14.1, < 0.15dev',
56-
'gapic-google-logging-v2 >= 0.10.1, < 0.11dev',
57-
'grpc-google-logging-v2 >= 0.10.1, < 0.11dev',
54+
'gapic-google-cloud-logging-v2 >= 0.14.0, < 0.15dev',
5855
]
5956

6057
setup(

logging/unit_tests/test__gax.py

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_list_entries_no_paging(self):
5858

5959
from google.api.monitored_resource_pb2 import MonitoredResource
6060
from google.gax import INITIAL_PAGE
61-
from google.logging.v2.log_entry_pb2 import LogEntry
61+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
6262

6363
from google.cloud._helpers import _datetime_to_pb_timestamp
6464
from google.cloud._helpers import UTC
@@ -103,8 +103,9 @@ def test_list_entries_no_paging(self):
103103
self.assertIsNone(entry.severity)
104104
self.assertIsNone(entry.http_request)
105105

106-
projects, filter_, order_by, page_size, options = (
106+
resource_names, projects, filter_, order_by, page_size, options = (
107107
gax_api._list_log_entries_called_with)
108+
self.assertEqual(resource_names, [])
108109
self.assertEqual(projects, [self.PROJECT])
109110
self.assertEqual(filter_, self.FILTER)
110111
self.assertEqual(order_by, DESCENDING)
@@ -115,7 +116,7 @@ def _list_entries_with_paging_helper(self, payload, struct_pb):
115116
import datetime
116117

117118
from google.api.monitored_resource_pb2 import MonitoredResource
118-
from google.logging.v2.log_entry_pb2 import LogEntry
119+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
119120
from google.cloud._helpers import _datetime_to_pb_timestamp
120121
from google.cloud._helpers import UTC
121122
from google.cloud._testing import _GAXPageIterator
@@ -158,8 +159,9 @@ def _list_entries_with_paging_helper(self, payload, struct_pb):
158159
self.assertIsNone(entry.severity)
159160
self.assertIsNone(entry.http_request)
160161

161-
projects, filter_, order_by, page_size, options = (
162+
resource_names, projects, filter_, order_by, page_size, options = (
162163
gax_api._list_log_entries_called_with)
164+
self.assertEqual(resource_names, [])
163165
self.assertEqual(projects, [self.PROJECT])
164166
self.assertEqual(filter_, '')
165167
self.assertEqual(order_by, '')
@@ -205,8 +207,9 @@ def test_list_entries_with_paging_nested_payload(self):
205207

206208
def _make_log_entry_with_extras(self, labels, iid, type_url, now):
207209
from google.api.monitored_resource_pb2 import MonitoredResource
208-
from google.logging.v2.log_entry_pb2 import LogEntry
209-
from google.logging.v2.log_entry_pb2 import LogEntryOperation
210+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
211+
from google.cloud.grpc.logging.v2.log_entry_pb2 import (
212+
LogEntryOperation)
210213
from google.logging.type.http_request_pb2 import HttpRequest
211214
from google.logging.type.log_severity_pb2 import WARNING
212215
from google.protobuf.any_pb2 import Any
@@ -311,16 +314,17 @@ def test_list_entries_with_extra_properties(self):
311314
'cacheHit': entry_pb.http_request.cache_hit,
312315
})
313316

314-
projects, filter_, order_by, page_size, options = (
317+
resource_names, projects, filter_, order_by, page_size, options = (
315318
gax_api._list_log_entries_called_with)
319+
self.assertEqual(resource_names, [])
316320
self.assertEqual(projects, [self.PROJECT])
317321
self.assertEqual(filter_, '')
318322
self.assertEqual(order_by, '')
319323
self.assertEqual(page_size, SIZE)
320324
self.assertEqual(options.page_token, TOKEN)
321325

322326
def test_write_entries_single(self):
323-
from google.logging.v2.log_entry_pb2 import LogEntry
327+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
324328
TEXT = 'TEXT'
325329
ENTRY = {
326330
'logName': self.LOG_PATH,
@@ -353,7 +357,7 @@ def test_write_entries_w_extra_properties(self):
353357
# pylint: disable=too-many-statements
354358
from datetime import datetime
355359
from google.logging.type.log_severity_pb2 import WARNING
356-
from google.logging.v2.log_entry_pb2 import LogEntry
360+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
357361
from google.cloud._helpers import UTC, _pb_timestamp_to_datetime
358362
NOW = datetime.utcnow().replace(tzinfo=UTC)
359363
TEXT = 'TEXT'
@@ -448,7 +452,7 @@ def _write_entries_multiple_helper(self, json_payload, json_struct_pb):
448452
# pylint: disable=too-many-statements
449453
import datetime
450454
from google.logging.type.log_severity_pb2 import WARNING
451-
from google.logging.v2.log_entry_pb2 import LogEntry
455+
from google.cloud.grpc.logging.v2.log_entry_pb2 import LogEntry
452456
from google.protobuf.any_pb2 import Any
453457
from google.cloud._helpers import _datetime_to_rfc3339, UTC
454458
TEXT = 'TEXT'
@@ -616,7 +620,7 @@ def test_ctor(self):
616620
def test_list_sinks_no_paging(self):
617621
import six
618622
from google.gax import INITIAL_PAGE
619-
from google.logging.v2.logging_config_pb2 import LogSink
623+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
620624
from google.cloud._testing import _GAXPageIterator
621625
from google.cloud.logging.sink import Sink
622626

@@ -651,7 +655,7 @@ def test_list_sinks_no_paging(self):
651655
self.assertEqual(options.page_token, INITIAL_PAGE)
652656

653657
def test_list_sinks_w_paging(self):
654-
from google.logging.v2.logging_config_pb2 import LogSink
658+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
655659
from google.cloud._testing import _GAXPageIterator
656660
from google.cloud.logging.sink import Sink
657661

@@ -707,7 +711,7 @@ def test_sink_create_conflict(self):
707711
self.DESTINATION_URI)
708712

709713
def test_sink_create_ok(self):
710-
from google.logging.v2.logging_config_pb2 import LogSink
714+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
711715
gax_api = _GAXSinksAPI()
712716
api = self._make_one(gax_api, None)
713717

@@ -740,7 +744,7 @@ def test_sink_get_miss(self):
740744
api.sink_get(self.PROJECT, self.SINK_NAME)
741745

742746
def test_sink_get_hit(self):
743-
from google.logging.v2.logging_config_pb2 import LogSink
747+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
744748

745749
RESPONSE = {
746750
'name': self.SINK_PATH,
@@ -782,7 +786,7 @@ def test_sink_update_miss(self):
782786
self.DESTINATION_URI)
783787

784788
def test_sink_update_hit(self):
785-
from google.logging.v2.logging_config_pb2 import LogSink
789+
from google.cloud.grpc.logging.v2.logging_config_pb2 import LogSink
786790

787791
response = LogSink(name=self.SINK_NAME,
788792
destination=self.DESTINATION_URI,
@@ -848,7 +852,7 @@ def test_ctor(self):
848852
def test_list_metrics_no_paging(self):
849853
import six
850854
from google.gax import INITIAL_PAGE
851-
from google.logging.v2.logging_metrics_pb2 import LogMetric
855+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
852856
from google.cloud._testing import _GAXPageIterator
853857
from google.cloud.logging.metric import Metric
854858

@@ -883,7 +887,7 @@ def test_list_metrics_no_paging(self):
883887
self.assertEqual(options.page_token, INITIAL_PAGE)
884888

885889
def test_list_metrics_w_paging(self):
886-
from google.logging.v2.logging_metrics_pb2 import LogMetric
890+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
887891
from google.cloud._testing import _GAXPageIterator
888892
from google.cloud.logging.metric import Metric
889893

@@ -939,7 +943,7 @@ def test_metric_create_conflict(self):
939943
self.DESCRIPTION)
940944

941945
def test_metric_create_ok(self):
942-
from google.logging.v2.logging_metrics_pb2 import LogMetric
946+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
943947
gax_api = _GAXMetricsAPI()
944948
api = self._make_one(gax_api, None)
945949

@@ -972,7 +976,7 @@ def test_metric_get_miss(self):
972976
api.metric_get(self.PROJECT, self.METRIC_NAME)
973977

974978
def test_metric_get_hit(self):
975-
from google.logging.v2.logging_metrics_pb2 import LogMetric
979+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
976980

977981
RESPONSE = {
978982
'name': self.METRIC_PATH,
@@ -1014,7 +1018,7 @@ def test_metric_update_miss(self):
10141018
self.DESCRIPTION)
10151019

10161020
def test_metric_update_hit(self):
1017-
from google.logging.v2.logging_metrics_pb2 import LogMetric
1021+
from google.cloud.grpc.logging.v2.logging_metrics_pb2 import LogMetric
10181022

10191023
response = LogMetric(name=self.METRIC_NAME,
10201024
description=self.DESCRIPTION,
@@ -1093,7 +1097,7 @@ def generated_api(channel=None):
10931097

10941098
patch = mock.patch.multiple(
10951099
'google.cloud.logging._gax',
1096-
LoggingServiceV2Api=generated_api,
1100+
LoggingServiceV2Client=generated_api,
10971101
make_secure_channel=make_channel)
10981102
with patch:
10991103
logging_api = self._call_fut(client)
@@ -1139,7 +1143,7 @@ def generated_api(channel=None):
11391143

11401144
patch = mock.patch.multiple(
11411145
'google.cloud.logging._gax',
1142-
MetricsServiceV2Api=generated_api,
1146+
MetricsServiceV2Client=generated_api,
11431147
make_secure_channel=make_channel)
11441148
with patch:
11451149
metrics_api = self._call_fut(client)
@@ -1185,7 +1189,7 @@ def generated_api(channel=None):
11851189

11861190
patch = mock.patch.multiple(
11871191
'google.cloud.logging._gax',
1188-
ConfigServiceV2Api=generated_api,
1192+
ConfigServiceV2Client=generated_api,
11891193
make_secure_channel=make_channel)
11901194
with patch:
11911195
sinks_api = self._call_fut(client)
@@ -1204,9 +1208,11 @@ class _GAXLoggingAPI(_GAXBaseAPI):
12041208
_delete_not_found = False
12051209

12061210
def list_log_entries(
1207-
self, projects, filter_, order_by, page_size, options):
1211+
self, resource_names, project_ids, filter_,
1212+
order_by, page_size, options):
12081213
self._list_log_entries_called_with = (
1209-
projects, filter_, order_by, page_size, options)
1214+
resource_names, project_ids, filter_,
1215+
order_by, page_size, options)
12101216
return self._list_log_entries_response
12111217

12121218
def write_log_entries(self, entries, log_name, resource, labels,

0 commit comments

Comments
 (0)