File tree Expand file tree Collapse file tree 4 files changed +11
-19
lines changed
packages/google-cloud-bigtable Expand file tree Collapse file tree 4 files changed +11
-19
lines changed Original file line number Diff line number Diff line change 2222from google .cloud .bigtable ._generated import (
2323 bigtable_instance_admin_pb2 as messages_v2_pb2 )
2424from google .cloud .operation import Operation
25- from google .cloud .operation import _compute_type_url
26- from google .cloud .operation import register_type_url
25+ from google .cloud .operation import register_type
2726
2827
2928_CLUSTER_NAME_RE = re .compile (r'^projects/(?P<project>[^/]+)/'
3433"""Default number of nodes to use when creating a cluster."""
3534
3635
37- _UPDATE_CLUSTER_METADATA_URL = _compute_type_url (
38- messages_v2_pb2 .UpdateClusterMetadata )
39- register_type_url (
40- _UPDATE_CLUSTER_METADATA_URL , messages_v2_pb2 .UpdateClusterMetadata )
36+ register_type (messages_v2_pb2 .UpdateClusterMetadata )
4137
4238
4339def _prepare_create_request (cluster ):
Original file line number Diff line number Diff line change 2727from google .cloud .bigtable .cluster import DEFAULT_SERVE_NODES
2828from google .cloud .bigtable .table import Table
2929from google .cloud .operation import Operation
30- from google .cloud .operation import _compute_type_url
31- from google .cloud .operation import register_type_url
30+ from google .cloud .operation import register_type
3231
3332
3433_EXISTING_INSTANCE_LOCATION_ID = 'see-existing-cluster'
3534_INSTANCE_NAME_RE = re .compile (r'^projects/(?P<project>[^/]+)/'
3635 r'instances/(?P<instance_id>[a-z][-a-z0-9]*)$' )
3736
3837
39- _CREATE_INSTANCE_METADATA_URL = _compute_type_url (
40- messages_v2_pb2 .CreateInstanceMetadata )
41- register_type_url (
42- _CREATE_INSTANCE_METADATA_URL , messages_v2_pb2 .CreateInstanceMetadata )
43- _INSTANCE_METADATA_URL = _compute_type_url (data_v2_pb2 .Instance )
44- register_type_url (_INSTANCE_METADATA_URL , data_v2_pb2 .Instance )
38+ register_type (messages_v2_pb2 .CreateInstanceMetadata )
39+ register_type (data_v2_pb2 .Instance )
4540
4641
4742def _prepare_create_request (instance ):
Original file line number Diff line number Diff line change @@ -283,7 +283,6 @@ def test_update(self):
283283 from google .cloud .bigtable ._generated import (
284284 bigtable_instance_admin_pb2 as messages_v2_pb2 )
285285 from unit_tests ._testing import _FakeStub
286- from google .cloud .bigtable .cluster import _UPDATE_CLUSTER_METADATA_URL
287286
288287 NOW = datetime .datetime .utcnow ()
289288 NOW_PB = _datetime_to_pb_timestamp (NOW )
@@ -307,10 +306,12 @@ def test_update(self):
307306 'operations/projects/%s/instances/%s/clusters/%s/operations/%d' %
308307 (self .PROJECT , self .INSTANCE_ID , self .CLUSTER_ID , OP_ID ))
309308 metadata = messages_v2_pb2 .UpdateClusterMetadata (request_time = NOW_PB )
309+ type_url = 'type.googleapis.com/%s' % (
310+ messages_v2_pb2 .UpdateClusterMetadata .DESCRIPTOR .full_name ,)
310311 response_pb = operations_pb2 .Operation (
311312 name = OP_NAME ,
312313 metadata = Any (
313- type_url = _UPDATE_CLUSTER_METADATA_URL ,
314+ type_url = type_url ,
314315 value = metadata .SerializeToString ()
315316 )
316317 )
Original file line number Diff line number Diff line change @@ -236,8 +236,6 @@ def test_create(self):
236236 from unit_tests ._testing import _FakeStub
237237 from google .cloud .operation import Operation
238238 from google .cloud .bigtable .cluster import DEFAULT_SERVE_NODES
239- from google .cloud .bigtable .instance import (
240- _CREATE_INSTANCE_METADATA_URL )
241239
242240 NOW = datetime .datetime .utcnow ()
243241 NOW_PB = _datetime_to_pb_timestamp (NOW )
@@ -247,10 +245,12 @@ def test_create(self):
247245
248246 # Create response_pb
249247 metadata = messages_v2_pb2 .CreateInstanceMetadata (request_time = NOW_PB )
248+ type_url = 'type.googleapis.com/%s' % (
249+ messages_v2_pb2 .CreateInstanceMetadata .DESCRIPTOR .full_name ,)
250250 response_pb = operations_pb2 .Operation (
251251 name = self .OP_NAME ,
252252 metadata = Any (
253- type_url = _CREATE_INSTANCE_METADATA_URL ,
253+ type_url = type_url ,
254254 value = metadata .SerializeToString (),
255255 )
256256 )
You can’t perform that action at this time.
0 commit comments