3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 var Promise
= require('bluebird');
21 var utils
= require('../../../framework/core/api_utils/utils.js');
22 var request
= utils
.request
;
23 var constants
= require('../../../framework/core/api_utils/constants.js');
24 var APIVersion
= '/v1';
25 var crashDetails
= {};
27 var _
= require('lodash');
29 crashDetails
.get = function(req
) {
30 var api_server
= req
.query
["api_server"];
32 return new Promise(function(resolve
, reject
) {
33 var requestHeaders
= {};
34 _
.extend(requestHeaders
,
35 constants
.HTTP_HEADERS
.accept
.data
, {
36 'Authorization': req
.get('Authorization')
39 url
: utils
.confdPort(api_server
) + APIVersion
+'/api/operational/crash?deep',
41 headers
: requestHeaders
,
42 forever
: constants
.FOREVER_ON
,
43 rejectUnauthorized
: false,
45 function(error
, response
, body
) {
48 if (utils
.validateResponse('crashDetails.get', error
, response
, body
, resolve
, reject
)) {
50 data
= JSON
.parse(response
.body
)['rwshell-mgmt:crash'].list
.vm
;
61 debug
.crashDetails
= crashDetails
;
63 module
.exports
= debug
;