1 /* 2 * Copyright 2010-2024 the Pacemaker project contributors 3 * 4 * The version control history for this file may have further details. 5 * 6 * This source code is licensed under the GNU Lesser General Public License 7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY. 8 */ 9 10 #ifndef PCMK__CRM_SERVICES_INTERNAL__H 11 #define PCMK__CRM_SERVICES_INTERNAL__H 12 13 #include <crm/services.h> // svc_action_t 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /*! 20 * \brief Create a new resource action 21 * 22 * \param[in] name Name of resource 23 * \param[in] standard Resource agent standard 24 * \param[in] provider Resource agent provider 25 * \param[in] agent Resource agent name 26 * \param[in] action Name of action 27 * \param[in] interval_ms How often to repeat action (if 0, execute once) 28 * \param[in] timeout Error if not complete within this time (ms) 29 * \param[in,out] params Action parameters 30 * \param[in] flags Group of enum svc_action_flags 31 * 32 * \return NULL if not enough memory, otherwise newly allocated action instance 33 * (if its rc member is not PCMK_OCF_UNKNOWN, the action is invalid) 34 * 35 * \note This function assumes ownership of (and may free) \p params. 36 * \note The caller is responsible for freeing the return value using 37 * services_action_free(). 38 */ 39 svc_action_t *services__create_resource_action(const char *name, 40 const char *standard, 41 const char *provider, 42 const char *agent, 43 const char *action, 44 guint interval_ms, 45 int timeout, GHashTable *params, 46 enum svc_action_flags flags); 47 48 const char *services__exit_reason(const svc_action_t *action); 49 char *services__grab_stdout(svc_action_t *action); 50 char *services__grab_stderr(svc_action_t *action); 51 52 void services__set_result(svc_action_t *action, int agent_status, 53 enum pcmk_exec_status exec_status, 54 const char *exit_reason); 55 56 void services__format_result(svc_action_t *action, int agent_status, 57 enum pcmk_exec_status exec_status, 58 const char *format, ...) G_GNUC_PRINTF(4, 5); 59 60 #ifdef __cplusplus 61 } 62 #endif 63 64 #endif // PCMK__CRM_SERVICES_INTERNAL__H