def commit(self): commit = self._build_commit_object() result = send_request(COMMIT_ENDPOINT, post_params=commit) if result['status'] == 'error': _handle_exception(result) self._confirm_changes()
def create(attributes): request = { 'attributes': attributes, } response = send_request(CREATE_ENDPOINT, post_params=request) if response['status'] == 'error': _handle_exception(response) return _format_obj(response['result'][0])
def _fetch_results(self): request_data = {'filters': self._filters} if self._restrict is not None: request_data['restrict'] = self._restrict if self._order_by is not None: request_data['order_by'] = self._order_by response = send_request(QUERY_ENDPOINT, post_params=request_data) if response['status'] == 'error': _handle_exception(response) return [_format_obj(s) for s in response['result']]
def _api_function(*args, **kwargs): call = { 'group': self.group, 'name': attr, 'args': args, 'kwargs': kwargs, } result = send_request(API_CALL_ENDPOINT, post_params=call) if result['status'] == 'error': raise ApiError(result['message'], status_code=None) return result['retval']
def _fetch_new_object(self, servertype): response = send_request(NEW_OBJECT_ENDPOINT, [('servertype', servertype)]) return _format_obj(response['result'])