1 /* 2 * Copyright 2010-2022 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__SERVICES_INTERNAL__H 11 # define PCMK__SERVICES_INTERNAL__H 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /*! 18 * \brief Create a new resource action 19 * 20 * \param[in] name Name of resource 21 * \param[in] standard Resource agent standard 22 * \param[in] provider Resource agent provider 23 * \param[in] agent Resource agent name 24 * \param[in] action Name of action 25 * \param[in] interval_ms How often to repeat action (if 0, execute once) 26 * \param[in] timeout Error if not complete within this time (ms) 27 * \param[in,out] params Action parameters 28 * \param[in] flags Group of enum svc_action_flags 29 * 30 * \return NULL if not enough memory, otherwise newly allocated action instance 31 * (if its rc member is not PCMK_OCF_UNKNOWN, the action is invalid) 32 * 33 * \note This function assumes ownership of (and may free) \p params. 34 * \note The caller is responsible for freeing the return value using 35 * services_action_free(). 36 */ 37 svc_action_t *services__create_resource_action(const char *name, 38 const char *standard, 39 const char *provider, 40 const char *agent, 41 const char *action, 42 guint interval_ms, 43 int timeout, GHashTable *params, 44 enum svc_action_flags flags); 45 46 const char *services__exit_reason(const svc_action_t *action); 47 char *services__grab_stdout(svc_action_t *action); 48 char *services__grab_stderr(svc_action_t *action); 49 50 void services__set_result(svc_action_t *action, int agent_status, 51 enum pcmk_exec_status exec_status, 52 const char *exit_reason); 53 54 void services__format_result(svc_action_t *action, int agent_status, 55 enum pcmk_exec_status exec_status, 56 const char *format, ...) G_GNUC_PRINTF(4, 5); 57 58 # ifdef __cplusplus 59 } 60 # endif 61 62 #endif /* PCMK__SERVICES_INTERNAL__H */