def delete(self): """Delete this instance. Marks a instance and all of its tables for permanent deletion in 7 days. Immediately upon completion of the request: * Billing will cease for all of the instance's reserved resources. * The instance's ``delete_time`` field will be set 7 days in the future. Soon afterward: * All tables within the instance will become unavailable. Prior to the instance's ``delete_time``: * The instance can be recovered with a call to ``UndeleteInstance``. * All other attempts to modify or delete the instance will be rejected. At the instance's ``delete_time``: * The instance and **all of its tables** will immediately and irrevocably disappear from the API, and their data will be permanently deleted. """ request_pb = messages_v2_pb2.DeleteInstanceRequest(name=self.name) # We expect a `google.protobuf.empty_pb2.Empty` self._client._instance_stub.DeleteInstance( request_pb, self._client.timeout_seconds)
def test_delete(self): from google.protobuf import empty_pb2 from gcloud.bigtable._generated import (bigtable_instance_admin_pb2 as messages_v2_pb) from gcloud.bigtable._testing import _FakeStub client = _Client(self.PROJECT, timeout_seconds=self.TIMEOUT_SECONDS) instance = self._makeOne(self.INSTANCE_ID, client, self.LOCATION_ID) # Create request_pb request_pb = messages_v2_pb.DeleteInstanceRequest( name=self.INSTANCE_NAME) # Create response_pb response_pb = empty_pb2.Empty() # Patch the stub used by the API method. client._instance_stub = stub = _FakeStub(response_pb) # Create expected_result. expected_result = None # delete() has no return value. # Perform the method and check the result. result = instance.delete() self.assertEqual(result, expected_result) self.assertEqual(stub.method_calls, [( 'DeleteInstance', (request_pb, self.TIMEOUT_SECONDS), {}, )])