Make designate record methods private for now

The API for designate is not something we can commit to right now. It
turns out that v1 has Domains and Records and v2 has Zones, RecordSets
and Records. Figuring out an API design that can handle both is not
going to happen before 1.0, so mark the current Record API as private
so that we can add something we can commit to later.

Change-Id: Ia2611f19d04a2d7a51d85ac99f19ed4054972085
This commit is contained in:
Monty Taylor 2015-10-21 01:50:40 +09:00
parent f7afb98dfe
commit 0d22456cba
2 changed files with 7 additions and 7 deletions

View File

@ -963,8 +963,8 @@ class OpenStackCloud(object):
zones = self.list_zones()
return _utils._filter_list(zones, name_or_id, filters)
def search_records(self, zone_id, name_or_id=None, filters=None):
records = self.list_records(zone_id=zone_id)
def _search_records(self, zone_id, name_or_id=None, filters=None):
records = self._list_records(zone_id=zone_id)
return _utils._filter_list(records, name_or_id, filters)
def list_keypairs(self):
@ -1247,7 +1247,7 @@ class OpenStackCloud(object):
raise OpenStackCloudException(
"Error fetching zone list: %s" % e)
def list_records(self, zone_id):
def _list_records(self, zone_id):
# TODO(mordred) switch domain= to zone= after the Big Rename
try:
return self.manager.submitTask(_tasks.RecordList(domain=zone_id))
@ -1583,8 +1583,8 @@ class OpenStackCloud(object):
"""
return _utils._get_entity(self.search_zones, name_or_id, filters)
def get_record(self, zone_id, name_or_id, filters=None):
f = lambda name_or_id, filters: self.search_records(
def _get_record(self, zone_id, name_or_id, filters=None):
f = lambda name_or_id, filters: self._search_records(
zone_id, name_or_id, filters)
return _utils._get_entity(f, name_or_id, filters)

View File

@ -376,10 +376,10 @@ class TestShade(base.TestCase):
self.assertIsNotNone(r)
self.assertDictEqual(zone1, r)
@mock.patch.object(shade.OpenStackCloud, 'list_records')
@mock.patch.object(shade.OpenStackCloud, '_list_records')
def test_get_record(self, mock_search):
record1 = dict(id='123', name='mickey', domain_id='mickey.domain')
mock_search.return_value = [record1]
r = self.cloud.get_record('mickey.domain', 'mickey')
r = self.cloud._get_record('mickey.domain', 'mickey')
self.assertIsNotNone(r)
self.assertDictEqual(record1, r)