diff --git a/designateclient/v2/cli/recordsets.py b/designateclient/v2/cli/recordsets.py index 00d93486..55f01c57 100644 --- a/designateclient/v2/cli/recordsets.py +++ b/designateclient/v2/cli/recordsets.py @@ -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) diff --git a/designateclient/v2/recordsets.py b/designateclient/v2/recordsets.py index 5096a69f..188148cc 100644 --- a/designateclient/v2/recordsets.py +++ b/designateclient/v2/recordsets.py @@ -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) diff --git a/doc/source/shell-v2.rst b/doc/source/shell-v2.rst index 1eff928d..482126c3 100644 --- a/doc/source/shell-v2.rst +++ b/doc/source/shell-v2.rst @@ -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