Ejemplo n.º 1
0
    def create_record_set(self, record_set, **kwargs):
        """
        Create a new record_set.

        :param record_set: the record_set to be created
        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/{0}/recordsets'.format(record_set.zone_id))
        response, data = self.__make_request(url, u'POST', self.headers, to_json_string(record_set), **kwargs)
        return RecordSetChange.from_dict(data)
Ejemplo n.º 2
0
def gen_rs_change(record_set):
    return RecordSetChange(zone=forward_zone,
                           record_set=record_set,
                           user_id='test-user',
                           change_type='Create',
                           status='Pending',
                           created=datetime.utcnow(),
                           system_message=None,
                           updates=record_set,
                           id='some-id',
                           user_name='some-username')
Ejemplo n.º 3
0
    def delete_record_set(self, zone_id, rs_id, **kwargs):
        """
        Delete an existing record_set.

        :param zone_id: the zone id the record_set belongs to
        :param rs_id: the id of the record_set to be deleted
        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/{0}/recordsets/{1}'.format(zone_id, rs_id))

        response, data = self.__make_request(url, u'DELETE', self.headers, **kwargs)
        return RecordSetChange.from_dict(data)
Ejemplo n.º 4
0
    def get_record_set_change(self, zone_id, rs_id, change_id, **kwargs):
        """
        Get an existing record_set change.

        :param zone_id: the zone id the record_set belongs to
        :param rs_id: the id of the record_set to be retrieved
        :param change_id: the id of the change to be retrieved
        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/{0}/recordsets/{1}/changes/{2}'.format(zone_id, rs_id, change_id))

        response, data = self.__make_request(url, u'GET', self.headers, None, **kwargs)
        return RecordSetChange.from_dict(data) if data is not None else None