예제 #1
0
    def get_batch_change(self, batch_change_id, **kwargs):
        """
        Get an existing batch change.

        :param batch_change_id: the unique identifier of the batchchange
        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/batchrecordchanges/{0}'.format(batch_change_id))
        response, data = self.__make_request(url, u'GET', self.headers, None, **kwargs)
        return BatchChange.from_dict(data) if data is not None else None
예제 #2
0
    def create_batch_change(self, batch_change_input, **kwargs):
        """
        Create a new batch change.

        :param batch_change_input: the batchchange to be created
        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/batchrecordchanges')
        response, data = self.__make_request(url, u'POST', self.headers, to_json_string(batch_change_input), **kwargs)
        return BatchChange.from_dict(data)
예제 #3
0
    def reject_batch_change(self, batch_change_id, rejection=None, **kwargs):
        """
        Reject a batch change

        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/batchrecordchanges/{0}/reject'.format(batch_change_id))
        response, data = self.__make_request(url, u'POST', self.headers,  to_review_json(rejection), **kwargs)

        return BatchChange.from_dict(data)
예제 #4
0
    def cancel_batch_change(self, batch_change_id, **kwargs):
        """
        Cancel a batch change

        :return: the content of the response
        """
        url = urljoin(self.index_url, u'/zones/batchrecordchanges/{0}/cancel'.format(batch_change_id))
        response, data = self.__make_request(url, u'POST', self.headers, **kwargs)

        return BatchChange.from_dict(data) if data is not None else None
예제 #5
0
    def approve_batch_change(self, batch_change_id, approval=None, **kwargs):
        """
        Approve a batch change

        :return: the content of the response
        """
        url = urljoin(self.index_url, '/zones/batchrecordchanges/{0}/approve'.format(batch_change_id),
                      to_json_string(approval))
        response, data = self.__make_request(url, u'POST', self.headers, to_review_json(approval), **kwargs)

        return BatchChange.from_dict(data)
예제 #6
0
    def create_batch_change(self, batch_change_input, allow_manual_review=None, **kwargs):
        """
        Create a new batch change.

        :param batch_change_input: the batchchange to be created
        :param allow_manual_review: set to false to fail rather than go to
        review if there are errors
        :return: the content of the response
        """
        arg = ''

        if allow_manual_review is not None:
            arg = u'allowManualReview={0}'.format(allow_manual_review)

        url = urljoin(self.index_url, u'/zones/batchrecordchanges') + u'?' + arg
        response, data = self.__make_request(url, u'POST', self.headers, to_json_string(batch_change_input), **kwargs)

        return BatchChange.from_dict(data)