diff --git a/dali/sasha/CMakeLists.txt b/dali/sasha/CMakeLists.txt index d411836f4eb..1ba66a6e957 100644 --- a/dali/sasha/CMakeLists.txt +++ b/dali/sasha/CMakeLists.txt @@ -24,6 +24,8 @@ project (sasha) +include (saruncmd.cmake) + INCLUDE(CheckLibraryExists) if (NOT WIN32 AND NOT WIN64) @@ -112,7 +114,8 @@ install ( TARGETS sasha RUNTIME DESTINATION ${EXEC_DIR}) target_link_libraries ( sasha ${XALAN_LIBRARIES} ${XERCES_LIBRARIES} jlib - mp + mp + saruncmdlib ) diff --git a/dali/sasha/saruncmd.cmake b/dali/sasha/saruncmd.cmake new file mode 100644 index 00000000000..64eae25e68d --- /dev/null +++ b/dali/sasha/saruncmd.cmake @@ -0,0 +1,47 @@ +################################################################################ +# HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems®. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + + +# Component: saruncmdlib +##################################################### +# Description: +# ------------ +# Cmake Input File for saruncmdlib +##################################################### + +project( saruncmdlib ) + +set ( SRCS + sacmd.cpp + saruncmd.cpp + ) + +include_directories ( + . + ${HPCC_SOURCE_DIR}/system/mp + ${HPCC_SOURCE_DIR}/system/include + ${HPCC_SOURCE_DIR}/system/jlib + ) + +ADD_DEFINITIONS ( -D_USRDLL -DSASHACLI_API_EXPORTS ) + +HPCC_ADD_LIBRARY( saruncmdlib SHARED ${SRCS} ) +install ( TARGETS saruncmdlib RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ) +target_link_libraries ( saruncmdlib + jlib + mp + ) + diff --git a/dali/sasha/saruncmd.cpp b/dali/sasha/saruncmd.cpp new file mode 100644 index 00000000000..c76d78a9e18 --- /dev/null +++ b/dali/sasha/saruncmd.cpp @@ -0,0 +1,101 @@ +#include "platform.h" +#include "jlib.hpp" +#include "mpbase.hpp" +#include "sacmd.hpp" +#include "saruncmd.hpp" + +class CSashaCmdExecutor : public CInterfaceOf +{ + Owned node; + unsigned defaultTimeoutMs = 60; + StringBuffer nodeText; + mutable StringBuffer lastServerMessage; + bool restoreWorkunit(const char *wuid, bool dfu) const + { + lastServerMessage.clear(); + Owned cmd = createSashaCommand(); + cmd->setAction(SCA_RESTORE); + if (dfu) + cmd->setDFU(true); + cmd->addId(wuid); + if (!cmd->send(node, defaultTimeoutMs)) + throw makeStringExceptionV(-1, "Could not connect to Sasha server on %s", nodeText.str()); + if (cmd->numIds()==0) + { + // nothing restored + return false; + } + cmd->getId(0, lastServerMessage); + return true; + } + bool archiveWorkunit(const char *wuid, bool dfu, bool deleteAfterArchiving) const + { + lastServerMessage.clear(); + Owned cmd = createSashaCommand(); + cmd->setAction(SCA_ARCHIVE); + if (dfu) + cmd->setDFU(true); + cmd->addId(wuid); + if (!cmd->send(node, defaultTimeoutMs)) + throw makeStringExceptionV(-1, "Could not connect to Sasha server on %s", nodeText.str()); + if (cmd->numIds()==0) + { + // nothing archived + return false; + } + cmd->getId(0, lastServerMessage); + return true; + } + +public: + CSashaCmdExecutor(const SocketEndpoint &ep, unsigned _defaultTimeoutSecs = 60) + { + ep.getEndpointHostText(nodeText); + node.setown(createINode(ep)); + defaultTimeoutMs = _defaultTimeoutSecs * 1000; + } + virtual StringBuffer &getVersion(StringBuffer &version) const override + { + Owned cmd = createSashaCommand(); + cmd->setAction(SCA_GETVERSION); + if (!cmd->send(node, defaultTimeoutMs)) + throw makeStringExceptionV(-1, "Could not connect to Sasha server on %s", nodeText.str()); + if (!cmd->getId(0, version)) + throw makeStringExceptionV(-1, "Sasha server[%s]: Protocol error", nodeText.str()); + return version; + } + virtual StringBuffer &getLastServerMessage(StringBuffer &message) const override + { + message.append(lastServerMessage); + return message; + } + virtual bool restoreECLWorkUnit(const char *wuid) const override + { + return restoreWorkunit(wuid, false); + } + virtual bool restoreDFUWorkUnit(const char *wuid) const override + { + return restoreWorkunit(wuid, true); + } + virtual bool archiveECLWorkUnit(const char *wuid) const override + { + return archiveWorkunit(wuid, false, true); + } + virtual bool archiveDFUWorkUnit(const char *wuid) const override + { + return archiveWorkunit(wuid, true, true); + } + virtual bool backupECLWorkUnit(const char *wuid) const override + { + return archiveWorkunit(wuid, false, false); + } + virtual bool backupDFUWorkUnit(const char *wuid) const override + { + return archiveWorkunit(wuid, true, false); + } +}; + +ISashaCmdExecutor *createSashaCmdExecutor(const SocketEndpoint &ep, unsigned defaultTimeoutSecs) +{ + return new CSashaCmdExecutor(ep, defaultTimeoutSecs); +} diff --git a/dali/sasha/saruncmd.hpp b/dali/sasha/saruncmd.hpp new file mode 100644 index 00000000000..70ab9af7b80 --- /dev/null +++ b/dali/sasha/saruncmd.hpp @@ -0,0 +1,24 @@ +#ifndef SARUNCMD_HPP +#define SARUNCMD_HPP + +#ifdef SARUNCMD_API_EXPORTS + #define SARUNCMD_API DECL_EXPORT +#else + #define SARUNCMD_API DECL_IMPORT +#endif + +interface ISashaCmdExecutor : extends IInterface +{ + virtual StringBuffer &getVersion(StringBuffer &version) const = 0; + virtual StringBuffer &getLastServerMessage(StringBuffer &lastServeressage) const = 0; + virtual bool restoreECLWorkUnit(const char *wuid) const = 0; + virtual bool restoreDFUWorkUnit(const char *wuid) const = 0; + virtual bool archiveECLWorkUnit(const char *wuid) const = 0; + virtual bool archiveDFUWorkUnit(const char *wuid) const = 0; + virtual bool backupECLWorkUnit(const char *wuid) const = 0; + virtual bool backupDFUWorkUnit(const char *wuid) const = 0; +}; + +extern SARUNCMD_API ISashaCmdExecutor *createSashaCmdExecutor(const SocketEndpoint &ep, unsigned defaultTimeoutSecs=60); + +#endif diff --git a/esp/applications/eclwatch/application.yaml b/esp/applications/eclwatch/application.yaml index 9d6a59e419e..21d1f967ef5 100644 --- a/esp/applications/eclwatch/application.yaml +++ b/esp/applications/eclwatch/application.yaml @@ -17,5 +17,6 @@ application: - ws_codesign - ws_resources - WSDali + - WSSasha - ws_logaccess - WsCloud diff --git a/esp/applications/eclwatch/ldap_authorization_map.yaml b/esp/applications/eclwatch/ldap_authorization_map.yaml index 84c2a8e3a9a..aa2a373f171 100644 --- a/esp/applications/eclwatch/ldap_authorization_map.yaml +++ b/esp/applications/eclwatch/ldap_authorization_map.yaml @@ -163,3 +163,8 @@ ldap: - path: WsLogAccess resource: WsLogAccess description: Access to HPCC component log + WSSasha: + Feature: + - path: SashaAccess + resource: SashaAccess + description: Access to HPCC Archive diff --git a/esp/applications/eclwatch/plugins.yaml b/esp/applications/eclwatch/plugins.yaml index 1f627ea4922..5eea9912281 100644 --- a/esp/applications/eclwatch/plugins.yaml +++ b/esp/applications/eclwatch/plugins.yaml @@ -21,6 +21,7 @@ service_plugins: ws_codesign: ws_codesign ws_resources: ws_resources WSDali: ws_dali + WSSasha: ws_sasha WsCloud: ws_cloud ws_logaccess: ws_logaccess @@ -43,5 +44,6 @@ binding_plugins: ws_codesign: ws_codesign ws_resources: ws_resources WSDali: ws_dali + WSSasha: ws_sasha WsCloud: ws_cloud ws_logaccess: ws_logaccess diff --git a/esp/scm/espscm.cmake b/esp/scm/espscm.cmake index 57e2bdd063c..a81791a83b4 100644 --- a/esp/scm/espscm.cmake +++ b/esp/scm/espscm.cmake @@ -43,6 +43,7 @@ set ( ESPSCM_SRCS ws_codesign.ecm ws_decoupledlogging.ecm ws_dali.ecm + ws_sasha.ecm ws_resources.ecm ws_logaccess.ecm ) diff --git a/esp/scm/ws_sasha.ecm b/esp/scm/ws_sasha.ecm new file mode 100644 index 00000000000..3289f3431c2 --- /dev/null +++ b/esp/scm/ws_sasha.ecm @@ -0,0 +1,57 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +############################################################################## */ + +EspInclude(common); + +ESPenum WUTypes : string +{ + ECL("ECL"), + DFU("DFU"), +}; + +ESPrequest [nil_remove] GetVersionRequest +{ +}; + +ESPresponse [exceptions_inline, nil_remove] ResultResponse +{ + string Result; +}; + +ESPrequest [nil_remove] ArchiveWURequest +{ + string Wuid; + ESPenum WUTypes WUType; + bool DeleteOnSuccess(true); +}; + +ESPrequest [nil_remove] RestoreWURequest +{ + string Wuid; + ESPenum WUTypes WUType; +}; + +ESPservice [auth_feature("DEFERRED"), //This declares that the method logic handles feature level authorization + version("1.00"), default_client_version("1.00"), exceptions_inline("./smc_xslt/exceptions.xslt")] WSSasha +{ + ESPmethod [auth_feature("SashaAccess:Access")] GetVersion(GetVersionRequest, ResultResponse); + ESPmethod [auth_feature("SashaAccess:FULL")] ArchiveWU(ArchiveWURequest, ResultResponse); //archive ECL WUs or DFU WUs + ESPmethod [auth_feature("SashaAccess:FULL")] RestoreWU(RestoreWURequest, ResultResponse); //restore ECL WUs or DFU WUs +}; + +SCMexportdef(WSSasha); +SCMapi(WSSasha) IClientWSSasha *createWSSashaClient(); diff --git a/esp/services/CMakeLists.txt b/esp/services/CMakeLists.txt index 43923d81f0a..007317d16ff 100644 --- a/esp/services/CMakeLists.txt +++ b/esp/services/CMakeLists.txt @@ -46,6 +46,7 @@ HPCC_ADD_SUBDIRECTORY (ws_store "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_codesign "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_resources "PLATFORM") HPCC_ADD_SUBDIRECTORY (ws_dali "PLATFORM") +HPCC_ADD_SUBDIRECTORY (ws_sasha "PLATFORM") if (CONTAINERIZED) HPCC_ADD_SUBDIRECTORY (ws_cloud "PLATFORM") else () diff --git a/esp/services/ws_sasha/CMakeLists.txt b/esp/services/ws_sasha/CMakeLists.txt new file mode 100644 index 00000000000..9b553521f69 --- /dev/null +++ b/esp/services/ws_sasha/CMakeLists.txt @@ -0,0 +1,71 @@ +################################################################################ +# HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +################################################################################ + +# Component: ws_sasha +##################################################### +# Description: +# ------------ +# Cmake Input File for ws_sasha +##################################################### + +project( ws_sasha ) + +include(${HPCC_SOURCE_DIR}/esp/scm/espscm.cmake) + +set ( SRCS + ${HPCC_SOURCE_DIR}/dali/sasha/sacmd.cpp + ${ESPSCM_GENERATED_DIR}/ws_sasha_esp.cpp + ws_sashaplugin.cpp + ws_sashaservice.cpp + ) + +include_directories ( + ${HPCC_SOURCE_DIR}/esp/platform + ${HPCC_SOURCE_DIR}/esp/bindings + ${HPCC_SOURCE_DIR}/esp/bindings/SOAP/xpp + ${HPCC_SOURCE_DIR}/esp/clients + ${HPCC_SOURCE_DIR}/esp/smc/SMCLib + ${HPCC_SOURCE_DIR}/system/include + ${HPCC_SOURCE_DIR}/system/jlib + ${HPCC_SOURCE_DIR}/system/xmllib + ${HPCC_SOURCE_DIR}/system/security/securesocket + ${HPCC_SOURCE_DIR}/system/security/LdapSecurity + ${HPCC_SOURCE_DIR}/system/security/shared + ${HPCC_SOURCE_DIR}/system/mp + ${HPCC_SOURCE_DIR}/common/thorhelper + ${HPCC_SOURCE_DIR}/common/environment + ${HPCC_SOURCE_DIR}/dali/base + ${HPCC_SOURCE_DIR}/dali/sasha + ) + +ADD_DEFINITIONS( -D_USRDLL -DWSSasha_API_LOCAL -DESP_SERVICE_WSSasha) + +HPCC_ADD_LIBRARY( ws_sasha SHARED ${SRCS} ) +install ( TARGETS ws_sasha RUNTIME DESTINATION ${EXEC_DIR} LIBRARY DESTINATION ${LIB_DIR} ) +target_link_libraries ( ws_sasha + jlib + xmllib + esphttp + SMCLib + saruncmdlib + ${COMMON_ESP_SERVICE_LIBS} + ) + +IF (USE_OPENSSL) + target_link_libraries ( ws_sasha + securesocket + ) +ENDIF() diff --git a/esp/services/ws_sasha/ws_sashaplugin.cpp b/esp/services/ws_sasha/ws_sashaplugin.cpp new file mode 100644 index 00000000000..a5c3c34cc45 --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaplugin.cpp @@ -0,0 +1,62 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +############################################################################## */ + +#pragma warning (disable : 4786) + +//ESP Bindings +#include "http/platform/httpprot.hpp" + +//ESP Service +#include "ws_sashaservice.hpp" + +#include "espplugin.hpp" + +extern "C" +{ + +//when we aren't loading dynamically +// Change the function names when we stick with dynamic loading. +ESP_FACTORY IEspService* esp_service_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + if (strieq(type, "WSSasha")) + { + CWSSashaEx* service = new CWSSashaEx; + service->init(cfg, process, name); + return service; + } + return nullptr; +} + +ESP_FACTORY IEspRpcBinding* esp_binding_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + //binding names of the form _http are being added so the names can be made more consistent and can therefore be automatically generated + // the name also better reflects that these bindings are for all HTTP based protocols, not just SOAP + // both "SoapBinding" and "_http" names instantiate the same objects. + if (strieq(type, "ws_sashaSoapBinding") || strieq(type, "WSSasha_http")) + { + return new CWSSashaSoapBinding(cfg, name, process); + } + + return nullptr; +} + +ESP_FACTORY IEspProtocol* esp_protocol_factory(const char* name, const char* type, IPropertyTree* cfg, const char* process) +{ + return http_protocol_factory(name, type, cfg, process); +} + +}; diff --git a/esp/services/ws_sasha/ws_sashaservice.cpp b/esp/services/ws_sasha/ws_sashaservice.cpp new file mode 100644 index 00000000000..a9868cb4231 --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaservice.cpp @@ -0,0 +1,151 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +############################################################################## */ + +#ifdef _USE_OPENLDAP +#include "ldapsecurity.ipp" +#endif + +#include "ws_sashaservice.hpp" +#include "jlib.hpp" +#include "TpWrapper.hpp" + +constexpr const char* FEATURE_URL = "SashaAccess"; + +ISashaCmdExecutor* CWSSashaEx::createSashaCommandExecutor(const char* archiverType) +{ + SocketEndpoint ep; + getSashaServiceEP(ep, archiverType, true); + return createSashaCmdExecutor(ep); +} + +ISashaCmdExecutor* CWSSashaEx::querySashaCommandExecutor(CWUTypes wuType) +{ + CriticalBlock block(sect); + if (wuType == CWUTypes_ECL) + { + if (!eclWUSashaCommandExecutor) + eclWUSashaCommandExecutor.setown(createSashaCommandExecutor(wuArchiverType)); + return eclWUSashaCommandExecutor.get(); + } + + if (!dfuWUSashaCommandExecutor) + dfuWUSashaCommandExecutor.setown(createSashaCommandExecutor(dfuwuArchiverType)); + return dfuWUSashaCommandExecutor.get(); +} + +void CWSSashaEx::init(IPropertyTree* cfg, const char* process, const char* service) +{ +} + +bool CWSSashaEx::onGetVersion(IEspContext& context, IEspGetVersionRequest& req, IEspResultResponse& resp) +{ + try + { + context.ensureFeatureAccess(FEATURE_URL, SecAccess_Read, ECLWATCH_SASHA_ACCESS_DENIED, "WSSashaEx.GetVersion: Permission denied."); + + StringBuffer results; + querySashaCommandExecutor(CWUTypes_ECL)->getVersion(results); + resp.setResult(results); + } + catch(IException* e) + { + FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); + } + + return true; +} + +void CWSSashaEx::setSuccess(ISashaCmdExecutor* executor, IEspResultResponse& resp) +{ + StringBuffer results; + executor->getLastServerMessage(results); + resp.setResult(results); +} + +void CWSSashaEx::setFailure(const char* wuid, const char* action, IEspResultResponse& resp) +{ + StringBuffer results; + if (isEmptyString(wuid)) + results.appendf("No workunits %s.", action); + else + results.appendf("Workunit %s not %s", wuid, action); + resp.setResult(results); +} + +bool CWSSashaEx::onArchiveWU(IEspContext& context, IEspArchiveWURequest& req, IEspResultResponse& resp) +{ + try + { + context.ensureFeatureAccess(FEATURE_URL, SecAccess_Full, ECLWATCH_SASHA_ACCESS_DENIED, "WSSashaEx.ArchiveWU: Permission denied."); + + const char* wuid = req.getWuid(); + CWUTypes wuType = req.getWUType(); + + ISashaCmdExecutor* executor = querySashaCommandExecutor(wuType); + bool sashaCmdSuccess = false; + if (req.getDeleteOnSuccess()) + { + if (wuType == CWUTypes_ECL) + sashaCmdSuccess = executor->archiveECLWorkUnit(isEmptyString(wuid) ? "*" : wuid); + else + sashaCmdSuccess = executor->archiveDFUWorkUnit(isEmptyString(wuid) ? "*" : wuid); + } + else + { + if (wuType == CWUTypes_ECL) + sashaCmdSuccess = executor->backupECLWorkUnit(isEmptyString(wuid) ? "*" : wuid); + else + sashaCmdSuccess = executor->backupDFUWorkUnit(isEmptyString(wuid) ? "*" : wuid); + } + if (sashaCmdSuccess) + setSuccess(executor, resp); + else + setFailure(wuid, "archived", resp); + } + catch(IException* e) + { + FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); + } + return true; +} + +bool CWSSashaEx::onRestoreWU(IEspContext& context, IEspRestoreWURequest& req, IEspResultResponse& resp) +{ + try + { + context.ensureFeatureAccess(FEATURE_URL, SecAccess_Full, ECLWATCH_SASHA_ACCESS_DENIED, "WSSashaEx.RestoreWU: Permission denied."); + + const char* wuid = req.getWuid(); + CWUTypes wuType = req.getWUType(); + + ISashaCmdExecutor* executor = querySashaCommandExecutor(wuType); + bool sashaCmdSuccess = false; + if ((wuType == CWUTypes_ECL)) + sashaCmdSuccess = executor->restoreECLWorkUnit(isEmptyString(wuid) ? "*" : wuid); + else + sashaCmdSuccess = executor->restoreDFUWorkUnit(isEmptyString(wuid) ? "*" : wuid); + if (sashaCmdSuccess) + setSuccess(executor, resp); + else + setFailure(wuid, "restored", resp); + } + catch(IException* e) + { + FORWARDEXCEPTION(context, e, ECLWATCH_INTERNAL_ERROR); + } + return true; +} diff --git a/esp/services/ws_sasha/ws_sashaservice.hpp b/esp/services/ws_sasha/ws_sashaservice.hpp new file mode 100644 index 00000000000..78a22bc1cfb --- /dev/null +++ b/esp/services/ws_sasha/ws_sashaservice.hpp @@ -0,0 +1,43 @@ +/*############################################################################## + + HPCC SYSTEMS software Copyright (C) 2023 HPCC Systems. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +############################################################################## */ + +#ifndef _ESPWIZ_ws_sasha_HPP__ +#define _ESPWIZ_ws_sasha_HPP__ + +#include "ws_sasha_esp.ipp" +#include "exception_util.hpp" +#include "mpbase.hpp" +#include "saruncmd.hpp" + +class CWSSashaEx : public CWSSasha +{ + CriticalSection sect; + Owned eclWUSashaCommandExecutor, dfuWUSashaCommandExecutor; + + ISashaCmdExecutor* createSashaCommandExecutor(const char* archiverType); + ISashaCmdExecutor* querySashaCommandExecutor(CWUTypes wuType); + void setSuccess(ISashaCmdExecutor* executor, IEspResultResponse& resp); + void setFailure(const char* wuid, const char* action, IEspResultResponse& resp); + +public: + virtual void init(IPropertyTree* cfg, const char* process, const char* service) override; + virtual bool onGetVersion(IEspContext& context, IEspGetVersionRequest& req, IEspResultResponse& resp) override; + virtual bool onArchiveWU(IEspContext& context, IEspArchiveWURequest& req, IEspResultResponse& resp) override; + virtual bool onRestoreWU(IEspContext& context, IEspRestoreWURequest& req, IEspResultResponse& resp) override; +}; + +#endif //_ESPWIZ_ws_sasha_HPP__ diff --git a/esp/smc/SMCLib/eclwatch_errorlist.hpp b/esp/smc/SMCLib/eclwatch_errorlist.hpp index 61b38b0d86e..22766d18c63 100644 --- a/esp/smc/SMCLib/eclwatch_errorlist.hpp +++ b/esp/smc/SMCLib/eclwatch_errorlist.hpp @@ -39,7 +39,8 @@ #define ECLWATCH_DFU_WU_ACCESS_DENIED ECLWATCH_ERROR_START+13 #define ECLWATCH_DFU_EX_ACCESS_DENIED ECLWATCH_ERROR_START+14 #define ECLWATCH_FILE_SPRAY_ACCESS_DENIED ECLWATCH_ERROR_START+15 -#define ECLWATCH_FILE_DESPRAY_ACCESS_DENIED ECLWATCH_ERROR_START+16 +#define ECLWATCH_FILE_DESPRAY_ACCESS_DENIED ECLWATCH_ERROR_START+16 +#define ECLWATCH_SASHA_ACCESS_DENIED ECLWATCH_ERROR_START+17 #define ECLWATCH_INVALID_SEC_MANAGER ECLWATCH_ERROR_START+30 #define ECLWATCH_INVALID_ACCOUNT_NAME ECLWATCH_ERROR_START+31