function monitoring_services_resources in Monitoring 7
Implements hook_services_resources().
Offer services resources:
- sensor-info: Available sensors info
- sensor-result: Available sensor results
File
- ./
monitoring.module, line 325 - Monitoring bootstrap file.
Code
function monitoring_services_resources() {
$resources = array();
$resources['sensor-info']['operations'] = array(
'index' => array(
'file' => array(
'type' => 'inc',
'module' => 'monitoring',
'name' => 'monitoring.services',
),
'help' => t('Available sensors info'),
'callback' => 'monitoring_services_sensors_info',
'access callback' => 'user_access',
'access arguments' => array(
'monitoring reports',
),
),
'retrieve' => array(
'file' => array(
'type' => 'inc',
'module' => 'monitoring',
'name' => 'monitoring.services',
),
'help' => t('Specific sensor info'),
'callback' => 'monitoring_services_sensor_info',
'access callback' => 'user_access',
'access arguments' => array(
'monitoring reports',
),
'args' => array(
array(
'name' => 'sensor_name',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'string',
'description' => 'Sensor name.',
),
),
),
);
$resources['sensor-result']['operations'] = array(
'index' => array(
'file' => array(
'type' => 'inc',
'module' => 'monitoring',
'name' => 'monitoring.services',
),
'help' => t('Available sensor results'),
'callback' => 'monitoring_services_sensors_results',
'access callback' => 'user_access',
'access arguments' => array(
'monitoring reports',
),
'args' => array(
array(
'name' => 'expand',
'type' => 'string',
'description' => t('Additional sensor result data to expand. I.e. expand=sensor_info'),
'source' => array(
'param' => 'expand',
),
'optional' => TRUE,
),
),
),
'retrieve' => array(
'file' => array(
'type' => 'inc',
'module' => 'monitoring',
'name' => 'monitoring.services',
),
'help' => t('Specific sensor result'),
'callback' => 'monitoring_services_sensor_result',
'access callback' => 'user_access',
'access arguments' => array(
'monitoring reports',
),
'args' => array(
array(
'name' => 'sensor_name',
'optional' => FALSE,
'source' => array(
'path' => 0,
),
'type' => 'string',
'description' => 'Sensor name.',
),
array(
'name' => 'expand',
'type' => 'string',
'description' => t('Additional sensor result data to expand. I.e. expand=sensor_info'),
'source' => array(
'param' => 'expand',
),
'optional' => TRUE,
),
),
),
);
return $resources;
}