def _handle_file(self, curr_file, container_id):
    file_name = curr_file.get('file_name')
    local_file_path = curr_file['file_path']
    contains = self._get_file_contains(local_file_path)
    vault_attach_dict = {}
    if (not file_name):
        file_name = os.path.basename(local_file_path)
    self._base_connector.debug_print('Vault file name: {0}'.format(file_name))
    vault_attach_dict[phantom.APP_JSON_ACTION_NAME] = self._base_connector.get_action_name()
    vault_attach_dict[phantom.APP_JSON_APP_RUN_ID] = self._base_connector.get_app_run_id()
    file_name = self._decode_uni_string(file_name, file_name)
    try:
        (success, message, vault_id) = phantom_rules.vault_add(file_location=local_file_path, container=container_id, file_name=file_name, metadata=vault_attach_dict)
    except Exception as e:
        self._base_connector.debug_print(phantom.APP_ERR_FILE_ADD_TO_VAULT.format(e))
        return (phantom.APP_ERROR, phantom.APP_ERROR)
    if (not success):
        self._base_connector.debug_print(PROC_EMAIL_FAILED_VAULT_ADD_FILE.format(message))
        return (phantom.APP_ERROR, phantom.APP_ERROR)
    cef_artifact = {}
    if file_name:
        cef_artifact.update({'fileName': file_name})
    if vault_id:
        cef_artifact.update({'vaultId': vault_id, 'cs6': vault_id, 'cs6Label': 'Vault ID'})
        self._add_vault_hashes_to_dictionary(cef_artifact, vault_id)
    if (not cef_artifact):
        return (phantom.APP_SUCCESS, phantom.APP_ERROR)
    artifact = {}
    artifact.update(_artifact_common)
    artifact['container_id'] = container_id
    artifact['name'] = 'Vault Artifact'
    artifact['cef'] = cef_artifact
    if contains:
        artifact['cef_types'] = {'vaultId': contains, 'cs6': contains}
    self._set_sdi(artifact)
    (ret_val, status_string, artifact_id) = self._base_connector.save_artifact(artifact)
    self._base_connector.debug_print(PROC_EMAIL_SAVE_CONT_PASSED.format(ret_val, status_string, artifact_id))
    return (phantom.APP_SUCCESS, ret_val)
def _handle_file(self, curr_file, container_id):
    file_name = curr_file.get('file_name')
    local_file_path = curr_file['file_path']
    contains = self._get_file_contains(local_file_path)
    vault_attach_dict = {}
    if (not file_name):
        file_name = os.path.basename(local_file_path)
    self._base_connector.debug_print('Vault file name: {0}'.format(file_name))
    vault_attach_dict[phantom.APP_JSON_ACTION_NAME] = self._base_connector.get_action_name()
    vault_attach_dict[phantom.APP_JSON_APP_RUN_ID] = self._base_connector.get_app_run_id()
    file_name = self._decode_uni_string(file_name, file_name)
    try:
        (success, message, vault_id) = phantom_rules.vault_add(file_location=local_file_path, container=container_id, file_name=file_name, metadata=vault_attach_dict)
    except Exception as e:
        self._base_connector.debug_print(phantom.APP_ERR_FILE_ADD_TO_VAULT.format(e))
        return (phantom.APP_ERROR, phantom.APP_ERROR)
    if (not success):
        self._base_connector.debug_print(PROC_EMAIL_FAILED_VAULT_ADD_FILE.format(message))
        return (phantom.APP_ERROR, phantom.APP_ERROR)
    cef_artifact = {}
    if file_name:
        cef_artifact.update({'fileName': file_name})
    if vault_id:
        cef_artifact.update({'vaultId': vault_id, 'cs6': vault_id, 'cs6Label': 'Vault ID'})
        self._add_vault_hashes_to_dictionary(cef_artifact, vault_id)
    if (not cef_artifact):
        return (phantom.APP_SUCCESS, phantom.APP_ERROR)
    artifact = {}
    artifact.update(_artifact_common)
    artifact['container_id'] = container_id
    artifact['name'] = 'Vault Artifact'
    artifact['cef'] = cef_artifact
    if contains:
        artifact['cef_types'] = {'vaultId': contains, 'cs6': contains}
    self._set_sdi(artifact)
    (ret_val, status_string, artifact_id) = self._base_connector.save_artifact(artifact)
    self._base_connector.debug_print(PROC_EMAIL_SAVE_CONT_PASSED.format(ret_val, status_string, artifact_id))
    return (phantom.APP_SUCCESS, ret_val)