def _handle_remove_member(self, param): self.save_progress("In action handler for: {0}".format( self.get_action_identifier())) action_result = self.add_action_result(ActionResult(dict(param))) uri = '/api/directory/remove-group-member' headers = self._get_request_headers(uri=uri, action_result=action_result) data = {"data": [{"id": param["id"]}]} data_object = {} member = param["member"] if phantom.is_domain(member): data_object['domain'] = member elif phantom.is_email(member): data_object['emailAddress'] = member if data_object: data['data'][0].update(data_object) ret_val, response = self._make_rest_call_helper(uri, action_result, headers=headers, method="post", data=data) if phantom.is_fail(ret_val): return ret_val try: action_result.add_data(response['data'][0]) except Exception: return action_result.set_status(phantom.APP_ERROR, MIMECAST_ERR_PROCESSING_RESPONSE) summary = action_result.update_summary({}) summary['status'] = MIMECAST_SUCC_REMOVE_MEMBER return action_result.set_status(phantom.APP_SUCCESS)
def _handle_remove_member(self, param): self.save_progress("In action handler for: {0}".format(self.get_action_identifier())) action_result = self.add_action_result(ActionResult(dict(param))) uri = '/api/directory/remove-group-member' headers = self._get_request_headers(uri=uri, action_result=action_result) data = { "data": [ { "id": param.get("id") } ] } data_object = {} member = param.get("member") if phantom.is_domain(member): data_object['domain'] = member elif phantom.is_email(member): data_object['emailAddress'] = member if data_object: data['data'][0].update(data_object) ret_val, response = self._make_rest_call_helper(uri, action_result, headers=headers, method="post", data=data) if phantom.is_fail(ret_val): return ret_val action_result.add_data(response['data'][0]) summary = action_result.update_summary({}) summary['status'] = "Successfully removed member from group" return action_result.set_status(phantom.APP_SUCCESS)