diff --git a/aa/rest.py b/aa/rest.py index 0ded918..aa7df77 100644 --- a/aa/rest.py +++ b/aa/rest.py @@ -59,12 +59,28 @@ def _rest_post(self, command, payload, headers, **kwargs): response = requests.post(url, payload, headers=headers) return response.json() - def get_all_pvs(self, limit=-1): - # This includes PVs that have connected in the past but are now - # disconnected (those from get_currently_disconnnected_pvs()), - # but not those that have never connected (those from - # get_never_connected_pvs()). - return self._rest_get('getAllPVs', limit=limit) + def get_all_pvs(self, pv=None, limit=-1): + """Return a list of PVs that are being archived. + + This includes PVs that have connected in the past but are now + disconnected (those from get_currently_disconnnected_pvs()), + but not those that have never connected (those from + get_never_connected_pvs()). + + Args: + pv: only return PV names that match pv, which may be a glob + limit: return a maximum of limit PV names. The default (-1) + returns all PV names + + Returns: + list of PV names + + """ + # Only supply the pv argument if it is not None. + kwargs = {'limit': limit} + if pv is not None: + kwargs['pv'] = pv + return self._rest_get('getAllPVs', **kwargs) def get_pv_type_info(self, pv): return self._rest_get('getPVTypeInfo', pv=pv) diff --git a/test/test_rest.py b/test/test_rest.py index 22f5865..793e583 100644 --- a/test/test_rest.py +++ b/test/test_rest.py @@ -27,7 +27,7 @@ def test_AaRestClient_construct_url(kwargs, aa_client): @pytest.mark.parametrize('command,method,kwargs', [ - ('getAllPVs', 'get_all_pvs', {'limit': -1}), + ('getAllPVs', 'get_all_pvs', {'pv': '*', 'limit': -1}), ('getPVTypeInfo', 'get_pv_type_info', {'pv': 'dummy'}), ('getPVStatus', 'get_pv_status', {'pv': 'dummy'}), ('getNeverConnectedPVs', 'get_never_connected_pvs', {}),