Repository: vinyldns/vinyldns-python

Issue:
Add RecordSets search support
### Description
The VinylDNS API has been updated to include a new [global recordset search endpoint](https://www.vinyldns.io/api/list-recordsets-global.html) at `/recordsets`. This client should be updated to support this new endpoint.

Discussion:
CLAassistant: [![CLA assistant check](https://cla-assistant.io/pull/badge/not_signed)](https://cla-assistant.io/vinyldns/vinyldns-python?pullRequest=72) <br/>Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our [Contributor License Agreement](https://cla-assistant.io/vinyldns/vinyldns-python?pullRequest=72) before we can accept your contribution.<br/><sub>You have signed the CLA already but the status is still pending? Let us [recheck](https://cla-assistant.io/check/vinyldns/vinyldns-python?pullRequest=72) it.</sub>
pauljamescleary: @remerle is this good now?
pauljamescleary: Thanks @jagadeesh545 !

Patch:
diff --git a/src/vinyldns/client.py b/src/vinyldns/client.py
index 56e137e..88240af 100644
--- a/src/vinyldns/client.py
+++ b/src/vinyldns/client.py
@@ -565,6 +565,40 @@ class VinylDNSClient(object):
         response, data = self.__make_request(url, u'GET', self.headers, **kwargs)
         return ListRecordSetsResponse.from_dict(data)
 
+    def search_record_sets(self, start_from=None, max_items=None, record_name_filter=None,
+                           record_type_filter=None, record_owner_group_filter=None, name_sort=None, **kwargs):
+        """
+        Retrieves a list of RecordSets globally in the VinylDNS database based on search criteria.
+        A minimum of two alpha-numeric characters is required.
+
+        :param start_from: the start key of the page
+        :param max_items: the page limit
+        :param record_name_filter: only returns record_sets whose names contain filter string
+        :param record_type_filter: only returns record_sets whose type is present in the given list
+        :param record_owner_group_filter: only returns record_sets belonging to the given owner
+        :param name_sort: sort the results as per given order
+        :return: the content of the response
+        """
+        args = []
+        if start_from is not None:
+            args.append(u'startFrom={0}'.format(start_from))
+        if max_items is not None:
+            args.append(u'maxItems={0}'.format(max_items))
+        if record_name_filter is not None:
+            args.append(u'recordNameFilter={0}'.format(record_name_filter))
+        if record_type_filter is not None:
+            for record_type in record_type_filter:
+                args.append(u'recordTypeFilter[]={0}'.format(record_type))
+        if record_owner_group_filter is not None:
+            args.append(u'recordOwnerGroupFilter={0}'.format(record_owner_group_filter))
+        if name_sort is not None:
+            args.append(u'nameSort={0}'.format(name_sort))
+
+        url = urljoin(self.index_url, u'/recordsets') + u'?' + u'&'.join(args)
+
+        response, data = self.__make_request(url, u'GET', self.headers, **kwargs)
+        return ListRecordSetsResponse.from_dict(data)
+
     def get_record_set_change(self, zone_id, rs_id, change_id, **kwargs):
         """
         Get an existing record_set change.


Test patch:
diff --git a/tests/test_records.py b/tests/test_records.py
index 7fcebe5..5412c6f 100644
--- a/tests/test_records.py
+++ b/tests/test_records.py
@@ -15,7 +15,7 @@
 import copy
 
 import responses
-from sampledata import record_set_values, gen_rs_change, forward_zone
+from sampledata import record_sets, record_set_values, gen_rs_change, forward_zone
 from vinyldns.record import RecordSet, RecordSetChange, ListRecordSetsResponse, ListRecordSetChangesResponse
 from vinyldns.serdes import to_json_string, from_json_string
 
@@ -114,6 +114,27 @@ def test_list_record_sets(mocked_responses, vinyldns_client):
         check_record_sets_are_equal(l, r)
 
 
+def test_search_record_sets(mocked_responses, vinyldns_client):
+    lrr = ListRecordSetsResponse(record_set_values, 'start', 'next', 100, '*')
+    all_record_types = list(record_sets.keys())
+    record_type_filter = ''
+    for record_type in all_record_types:
+        record_type_filter += '&recordTypeFilter[]={0}'.format(record_type)
+    mocked_responses.add(
+        responses.GET,
+        'http://test.com/recordsets?startFrom=start&maxItems=100&recordNameFilter=*' +
+        record_type_filter + '&recordOwnerGroupFilter=owner-group-id&nameSort=DESC',
+        body=to_json_string(lrr), status=200
+    )
+    r = vinyldns_client.search_record_sets('start', 100, '*', all_record_types, 'owner-group-id', 'DESC')
+    assert r.start_from == lrr.start_from
+    assert r.next_id == lrr.next_id
+    assert r.record_name_filter == lrr.record_name_filter
+    assert r.max_items == lrr.max_items
+    for l, r in zip(r.record_sets, lrr.record_sets):
+        check_record_sets_are_equal(l, r)
+
+
 def test_get_record_set_change(record_set, mocked_responses, vinyldns_client):
     change = gen_rs_change(record_set)
     mocked_responses.add(