def api_get_production_servers():
		if request.method == 'GET':
			return jsonify(ResourceGetProductionServers()._show_help())
		try:
			data = CommonResource.handle_request(request, ResourceGetProductionServers.required_post)
		except Exception, e:
			CommonLogger.log(e, 'get_production_servers', 'api_get_production_servers')
			return jsonify({'response': {'error': str(e)}})
예제 #2
0
	def api_get_all_roles():
		if request.method == 'GET':
			return jsonify(ResourceGetAllRoles()._show_help())
		try:
			data = CommonResource.handle_request(request, ResourceGetAllRoles.required_post)
		except Exception, e:
			CommonLogger.log(e, 'get_all_roles', 'api_get_all_roles')
			return jsonify({'response': {'error': str(e)}})
 def api_get_recent_transactions():
     if request.method == "GET":
         return jsonify(ResourceGetRecentTransactions()._show_help())
     try:
         data = CommonResource.handle_request(request=request, params=ResourceGetRecentTransactions.required_post)
     except Exception, e:
         report = CommonLogger.log(error=e, source="get_recent_transactions", method="api_get_recent_transactions-1")
         return jsonify(report)
예제 #4
0
	def api_remove_alert_server():
		role = 'production_servers'
		if request.method == 'GET':
			return jsonify(ResourceRemoveAlertServer()._show_help())
		try:
			data = CommonResource.handle_request(request, ResourceRemoveAlertServer.required_post)
		except Exception, e:
			CommonLogger.log(e, 'remove_alert_server', 'api_remove_alert_server')
			return jsonify({'response': {'error': str(e)}})
예제 #5
0
 def api_get_disk_usage():
     if request.method == 'GET':
         return jsonify(ResourceGetDiskUsage()._show_help())
     try:
         data = CommonResource.handle_request(
             request=request, params=ResourceGetDiskUsage.required_post)
     except Exception, e:
         report = CommonLogger.log(error=e,
                                   source='get_disk_usage',
                                   method='api_get_disk_usage')
         return jsonify(report)
예제 #6
0
 def api_create_log_entry():
     if request.method == 'GET':
         return jsonify(ResourceCreateLogEntry()._show_help())
     try:
         data = CommonResource.handle_request(
             request=request, params=ResourceCreateLogEntry.required_post)
     except Exception, e:
         report = CommonLogger.log(error=e,
                                   source='create_log_entry',
                                   method='api_create_log_entry-1')
         return jsonify(report)
 def api_get_recent_transactions():
     if request.method == 'GET':
         return jsonify(ResourceGetRecentTransactions()._show_help())
     try:
         data = CommonResource.handle_request(
             request=request,
             params=ResourceGetRecentTransactions.required_post)
     except Exception, e:
         report = CommonLogger.log(error=e,
                                   source='get_recent_transactions',
                                   method='api_get_recent_transactions-1')
         return jsonify(report)
예제 #8
0
	def api_send_warnings_alerts():
		if request.method == 'GET':
			return jsonify(ResourceSendWarningsAlerts()._show_help())
		try:
			data = CommonResource.handle_request(
				request=request,
				params=ResourceSendWarningsAlerts.required_post
				)
		except Exception, e:
			report = CommonLogger.log(
				error=e,
				source='create_event_notice',
				method='api_create_event_notice-1'
				)
			return jsonify(report)
	def api_create_log_entry():
		if request.method == 'GET':
			return jsonify(ResourceCreateLogEntry()._show_help())
		try:
			data = CommonResource.handle_request(
				request=request,
				params=ResourceCreateLogEntry.required_post
				)
		except Exception, e:
			report = CommonLogger.log(
				error=e,
				source='create_log_entry',
				method='api_create_log_entry-1'
				)
			return jsonify(report)
예제 #10
0
	def api_get_disk_usage():
		if request.method == 'GET':
			return jsonify(ResourceGetDiskUsage()._show_help())
		try:
			data = CommonResource.handle_request(
				request=request,
				params=ResourceGetDiskUsage.required_post
				)
		except Exception, e:
			report = CommonLogger.log(
				error=e,
				source='get_disk_usage',
				method='api_get_disk_usage'
				)
			return jsonify(report)
예제 #11
0
	def request_cpu_api():
		# Return help for 'GET' requests
		if request.method == 'GET':
			return jsonify(ResourceGetProductionServers()._show_help())

		# data is an object with all your first level POST fields as attributes
		data = CommonResource.handle_request(request, ResourceGetProductionServers.required_post)

		try:

# Add your request handling code here
#-----------------------------------------------------------------------#

			# use this if you have an agent plugin and want to execute async tasks
			response = ResourceTemplate().create_async_job(data)

# Built-in error handling
#-----------------------------------------------------------------------#
		except Exception, e:
			CommonLogger.log(e, self.source, 'request_cpu_api')
			return jsonify({'response': {'error': str(e)}})