Skip to content

Commit

Permalink
Accomodate final V2 renames: 'name' -> 'parent'.
Browse files Browse the repository at this point in the history
Closes #1918.
  • Loading branch information
tseaver committed Jun 28, 2016
1 parent 568a463 commit 24989d6
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gcloud/bigtable/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _prepare_create_request(cluster):
:returns: The CreateCluster request object containing the cluster info.
"""
return messages_v2_pb2.CreateClusterRequest(
name=cluster._instance.name,
parent=cluster._instance.name,
cluster_id=cluster.cluster_id,
cluster=data_v2_pb2.Cluster(
serve_nodes=cluster.serve_nodes,
Expand Down
6 changes: 3 additions & 3 deletions gcloud/bigtable/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _prepare_create_request(instance):
"""
parent_name = ('projects/' + instance._client.project)
return messages_v2_pb2.CreateInstanceRequest(
name=parent_name,
parent=parent_name,
instance_id=instance.instance_id,
instance=data_v2_pb2.Instance(
display_name=instance.display_name,
Expand Down Expand Up @@ -412,7 +412,7 @@ def list_clusters(self):
returned and the second is a list of strings (the failed
locations in the request).
"""
request_pb = messages_v2_pb2.ListClustersRequest(name=self.name)
request_pb = messages_v2_pb2.ListClustersRequest(parent=self.name)
# We expect a `.cluster_messages_v1_pb2.ListClustersResponse`
list_clusters_response = self._client._instance_stub.ListClusters(
request_pb, self._client.timeout_seconds)
Expand Down Expand Up @@ -442,7 +442,7 @@ def list_tables(self):
:raises: :class:`ValueError <exceptions.ValueError>` if one of the
returned tables has a name that is not of the expected format.
"""
request_pb = table_messages_v2_pb2.ListTablesRequest(name=self.name)
request_pb = table_messages_v2_pb2.ListTablesRequest(parent=self.name)
# We expect a `table_messages_v2_pb2.ListTablesResponse`
table_list_pb = self._client._table_stub.ListTables(
request_pb, self._client.timeout_seconds)
Expand Down
2 changes: 1 addition & 1 deletion gcloud/bigtable/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def create(self, initial_split_keys=None):
split_pb(key=key) for key in initial_split_keys]
request_pb = table_admin_messages_v2_pb2.CreateTableRequest(
initial_splits=initial_split_keys or [],
name=self._instance.name,
parent=self._instance.name,
table_id=self.table_id,
)
client = self._instance._client
Expand Down
2 changes: 1 addition & 1 deletion gcloud/bigtable/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def test_it(self):
request_pb = self._callFUT(cluster)

self.assertEqual(request_pb.cluster_id, CLUSTER_ID)
self.assertEqual(request_pb.name, instance.name)
self.assertEqual(request_pb.parent, instance.name)
self.assertEqual(request_pb.cluster.serve_nodes, SERVE_NODES)


Expand Down
8 changes: 4 additions & 4 deletions gcloud/bigtable/test_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def test_list_clusters(self):
CLUSTER_NAME2 = (instance.name + '/clusters/' + CLUSTER_ID2)
# Create request_pb
request_pb = messages_v2_pb2.ListClustersRequest(
name=instance.name,
parent=instance.name,
)

# Create response_pb
Expand Down Expand Up @@ -520,7 +520,7 @@ def _list_tables_helper(self, table_name=None):

# Create request_
request_pb = table_messages_v1_pb2.ListTablesRequest(
name=self.INSTANCE_NAME)
parent=self.INSTANCE_NAME)

# Create response_pb
if table_name is None:
Expand Down Expand Up @@ -588,7 +588,7 @@ def test_it(self):
self.assertTrue(isinstance(request_pb,
messages_v2_pb.CreateInstanceRequest))
self.assertEqual(request_pb.instance_id, INSTANCE_ID)
self.assertEqual(request_pb.name,
self.assertEqual(request_pb.parent,
'projects/' + PROJECT)
self.assertTrue(isinstance(request_pb.instance, data_v2_pb2.Instance))
self.assertEqual(request_pb.instance.display_name, DISPLAY_NAME)
Expand Down Expand Up @@ -637,7 +637,7 @@ def test_with_create_instance_metadata(self):
request_time=Timestamp(seconds=1, nanos=1234),
finish_time=Timestamp(seconds=10, nanos=891011),
original_request=messages_v2_pb.CreateInstanceRequest(
name='foo',
parent='foo',
instance_id='bar',
instance=data_v2_pb2.Instance(
display_name='quux',
Expand Down
2 changes: 1 addition & 1 deletion gcloud/bigtable/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _create_test_helper(self, initial_split_keys):
for key in initial_split_keys or ()]
request_pb = _CreateTableRequestPB(
initial_splits=splits_pb,
name=self.INSTANCE_NAME,
parent=self.INSTANCE_NAME,
table_id=self.TABLE_ID,
)

Expand Down

0 comments on commit 24989d6

Please sign in to comment.