salt.modules.hipchat

Module for sending messages to hipchat.

2015.5.0 新版功能.

configuration:

This module can be used by either passing an api key and version directly or by specifying both in a configuration profile in the salt master/minion config.

For example:

hipchat:
  api_key: peWcBiMOS9HrZG15peWcBiMOS9HrZG15
  api_version: v1
salt.modules.hipchat.find_room(name, api_key=None, api_version=None)

Find a room by name and return it. :param name: The room name. :param api_key: The HipChat admin api key. :param api_version: The HipChat api version, if not specified in the configuration. :return: The room object.

CLI Example:

salt '*' hipchat.find_room name="Development Room"

salt '*' hipchat.find_room name="Development Room" api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_version=v1
salt.modules.hipchat.find_user(name, api_key=None, api_version=None)

Find a user by name and return it. :param name: The user name. :param api_key: The HipChat admin api key. :param api_version: The HipChat api version, if not specified in the configuration. :return: The user object.

CLI Example:

salt '*' hipchat.find_user name="Thomas Hatch"

salt '*' hipchat.find_user name="Thomas Hatch" api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_version=v1
salt.modules.hipchat.list_rooms(api_key=None, api_version=None)

List all HipChat rooms.

参数:
  • api_key -- The HipChat admin api key.
  • api_version -- The HipChat api version, if not specified in the configuration.
返回:

The room list.

CLI Example:

salt '*' hipchat.list_rooms

salt '*' hipchat.list_rooms api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_version=v1
salt.modules.hipchat.list_users(api_key=None, api_version=None)

List all HipChat users. :param api_key: The HipChat admin api key. :param api_version: The HipChat api version, if not specified in the configuration. :return: The user list.

CLI Example:

salt '*' hipchat.list_users

salt '*' hipchat.list_users api_key=peWcBiMOS9HrZG15peWcBiMOS9HrZG15 api_version=v1
salt.modules.hipchat.send_message(room_id, message, from_name, api_key=None, api_version=None, color='yellow', notify=False)

Send a message to a HipChat room. :param room_id: The room id or room name, either will work. :param message: The message to send to the HipChat room. :param from_name: Specify who the message is from. :param api_key: The HipChat api key, if not specified in the configuration. :param api_version: The HipChat api version, if not specified in the configuration. :param color: The color for the message, default: yellow. :param notify: Whether to notify the room, default: False. :return: Boolean if message was sent successfully.

CLI Example:

salt '*' hipchat.send_message room_id="Development Room" message="Build is done" from_name="Build Server"

salt '*' hipchat.send_message room_id="Development Room" message="Build failed" from_name="Build Server" color="red" notify=True