Allow cli to query "v2/recordsets"
The allows users to list all recordsets in the system. running ``openstack recordset list all`` will show all rrsets Change-Id: Id47961c80484550c99c1834a554afe31165b69ca
This commit is contained in:
parent
f1541866e5
commit
eedd4ac142
@ -54,7 +54,8 @@ class ListRecordSetsCommand(lister.Lister):
|
||||
parser.add_argument('--action', help="RecordSet Action",
|
||||
required=False)
|
||||
|
||||
parser.add_argument('zone_id', help="Zone ID")
|
||||
parser.add_argument('zone_id', help="Zone ID. To list all"
|
||||
" recordsets specify 'all'")
|
||||
|
||||
return parser
|
||||
|
||||
@ -85,8 +86,13 @@ class ListRecordSetsCommand(lister.Lister):
|
||||
|
||||
cols = self.columns
|
||||
|
||||
data = get_all(client.recordsets.list, args=[parsed_args.zone_id],
|
||||
criterion=criterion)
|
||||
if parsed_args.zone_id == 'all':
|
||||
data = get_all(client.recordsets.list_all_zones,
|
||||
criterion=criterion)
|
||||
cols.insert(2, 'zone_name')
|
||||
else:
|
||||
data = get_all(client.recordsets.list, args=[parsed_args.zone_id],
|
||||
criterion=criterion)
|
||||
|
||||
for i, rs in enumerate(data):
|
||||
data[i] = _format_recordset(rs)
|
||||
|
@ -74,6 +74,12 @@ class RecordSetController(V2Controller):
|
||||
|
||||
return self._get(url, response_key='recordsets')
|
||||
|
||||
def list_all_zones(self, criterion=None, marker=None, limit=None):
|
||||
|
||||
url = self.build_url('/recordsets', criterion, marker, limit)
|
||||
|
||||
return self._get(url, response_key='recordsets')
|
||||
|
||||
def get(self, zone, recordset):
|
||||
zone = v2_utils.resolve_by_name(self.client.zones.list, zone)
|
||||
recordset = v2_utils.resolve_by_name(self.list, recordset, zone)
|
||||
|
@ -96,6 +96,7 @@ zone set Set zone properties
|
||||
zone delete Delete zone
|
||||
recordset create Create new recordset
|
||||
recordset list List recordsets
|
||||
recordset list all List all recordsets in all zones
|
||||
recordset show Show recordset details
|
||||
recordset set Set recordset properties
|
||||
recordset delete Delete recordset
|
||||
|
Loading…
Reference in New Issue
Block a user