ajax.js 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. /**
  20. * Config for each ajax-request
  21. *
  22. * Fields example:
  23. * mock - testMode url
  24. * real - real url (without API prefix)
  25. * type - request type (also may be defined in the format method)
  26. * format - function for processing ajax params after default formatRequest. May be called with one or two parameters (data, opt). Return ajax-params object
  27. * testInProduction - can this request be executed on production tests (used only in tests)
  28. *
  29. * @type {Object}
  30. */
  31. var urls = {
  32. 'common.services.update' : {
  33. 'real': '/clusters/{clusterName}/services?{urlParams}',
  34. 'mock': '/data/wizard/deploy/poll_1.json',
  35. 'format': function (data) {
  36. return {
  37. type: 'PUT',
  38. data: JSON.stringify({
  39. RequestInfo: {
  40. "context": data.context,
  41. "operation_level": {
  42. "level": "CLUSTER",
  43. "cluster_name" : data.clusterName
  44. }
  45. },
  46. Body: {
  47. ServiceInfo: data.ServiceInfo
  48. }
  49. })
  50. };
  51. }
  52. },
  53. 'common.service.update' : {
  54. 'real': '/clusters/{clusterName}/services/{serviceName}',
  55. 'mock': '/data/wizard/deploy/poll_1.json',
  56. 'format': function (data) {
  57. return {
  58. type: 'PUT',
  59. data: JSON.stringify({
  60. RequestInfo: {
  61. "context": data.context,
  62. "operation_level": {
  63. "level": "SERVICE",
  64. "cluster_name" : data.clusterName,
  65. "service_name" : data.serviceName
  66. }
  67. },
  68. Body: {
  69. ServiceInfo: data.ServiceInfo
  70. }
  71. })
  72. };
  73. }
  74. },
  75. 'common.host.host_components.update': {
  76. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components?{urlParams}',
  77. 'mock': '',
  78. 'type': 'PUT',
  79. 'format': function (data) {
  80. return {
  81. data: JSON.stringify({
  82. RequestInfo: {
  83. "context": data.context,
  84. "operation_level": {
  85. level: "HOST",
  86. cluster_name: data.clusterName,
  87. host_names: data.hostName
  88. },
  89. query: data.query
  90. },
  91. Body: {
  92. "HostRoles": data.HostRoles
  93. }
  94. })
  95. }
  96. }
  97. },
  98. 'common.host.host_component.update': {
  99. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?{urlParams}',
  100. 'mock': '/data/wizard/deploy/poll_1.json',
  101. 'type': 'PUT',
  102. 'format': function (data) {
  103. return {
  104. data: JSON.stringify({
  105. RequestInfo: {
  106. "context": data.context,
  107. "operation_level": {
  108. level: "HOST_COMPONENT",
  109. cluster_name: data.clusterName,
  110. host_name: data.hostName,
  111. service_name: data.serviceName || null
  112. }
  113. },
  114. Body: {
  115. "HostRoles": data.HostRoles
  116. }
  117. })
  118. }
  119. }
  120. },
  121. 'common.host_components.update': {
  122. 'real': '/clusters/{clusterName}/host_components?{urlParams}',
  123. 'mock': '/data/wizard/deploy/poll_1.json',
  124. 'type': 'PUT',
  125. 'format': function (data) {
  126. return {
  127. data: JSON.stringify({
  128. RequestInfo: {
  129. "context": data.context,
  130. "operation_level": {
  131. level: "CLUSTER",
  132. cluster_name: data.clusterName
  133. },
  134. query: data.query
  135. },
  136. Body: {
  137. "HostRoles": data.HostRoles
  138. }
  139. })
  140. }
  141. }
  142. },
  143. 'common.service.passive': {
  144. 'real': '/clusters/{clusterName}/services/{serviceName}',
  145. 'mock': '',
  146. 'format': function (data) {
  147. return {
  148. type: 'PUT',
  149. data: JSON.stringify({
  150. RequestInfo: {
  151. "context": data.requestInfo
  152. },
  153. Body: {
  154. ServiceInfo: {
  155. maintenance_state: data.passive_state
  156. }
  157. }
  158. })
  159. };
  160. }
  161. },
  162. 'common.host.host_component.passive': {
  163. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  164. 'mock': '',
  165. 'type': 'PUT',
  166. 'format': function(data) {
  167. return {
  168. data: JSON.stringify({
  169. RequestInfo: {
  170. "context": data.context
  171. },
  172. Body: {
  173. HostRoles: {
  174. maintenance_state: data.passive_state
  175. }
  176. }
  177. })
  178. };
  179. }
  180. },
  181. 'common.delete.host': {
  182. 'real': '/clusters/{clusterName}/hosts/{hostName}',
  183. 'type': 'DELETE'
  184. },
  185. 'common.delete.host_component': {
  186. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  187. 'type': 'DELETE'
  188. },
  189. 'common.delete.user': {
  190. 'real': '/users/{user}',
  191. 'type': 'DELETE'
  192. },
  193. 'common.delete.config_group': {
  194. 'real': '/clusters/{clusterName}/config_groups/{id}',
  195. 'type': 'DELETE'
  196. },
  197. 'common.delete.cluster': {
  198. 'real': '/clusters/{name}',
  199. 'type': 'DELETE'
  200. },
  201. 'common.delete.request_schedule': {
  202. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  203. 'type': 'DELETE'
  204. },
  205. 'alerts.get_by_service': {
  206. 'real': '/clusters/{clusterName}/services/{serviceName}?fields=alerts',
  207. 'mock': '/data/alerts/HDP2/service_alerts.json'
  208. },
  209. 'alerts.get_by_host': {
  210. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=alerts',
  211. 'mock': '/data/alerts/HDP2/host_alerts.json'
  212. },
  213. 'background_operations.get_most_recent': {
  214. 'real': '/clusters/{clusterName}/requests?to=end&page_size=10&fields=Requests',
  215. 'mock': '/data/background_operations/list_on_start.json',
  216. 'testInProduction': true
  217. },
  218. 'background_operations.get_by_request': {
  219. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/command,tasks/Tasks/command_detail,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/exit_code,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
  220. 'mock': '/data/background_operations/task_by_request{requestId}.json',
  221. 'testInProduction': true
  222. },
  223. 'background_operations.get_by_task': {
  224. 'real': '/clusters/{clusterName}/requests/{requestId}/tasks/{taskId}',
  225. 'mock': '/data/background_operations/list_on_start.json',
  226. 'testInProduction': true
  227. },
  228. 'service.item.smoke': {
  229. 'real': '/clusters/{clusterName}/requests',
  230. 'mock': '/data/wizard/deploy/poll_1.json',
  231. 'format': function (data) {
  232. return {
  233. 'type': 'POST',
  234. data: JSON.stringify({
  235. "RequestInfo": {
  236. "context": data.displayName + " Service Check",
  237. "command" : data.actionName
  238. },
  239. "Requests/resource_filters": [{"service_name" : data.serviceName}]
  240. })
  241. };
  242. }
  243. },
  244. 'service.load_config_groups': {
  245. 'real': '/clusters/{clusterName}/config_groups?ConfigGroup/tag={serviceName}&fields=*',
  246. 'mock': '/data/configurations/config_group.json'
  247. },
  248. 'service.flume.agent.command': {
  249. 'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER',
  250. 'mock': '',
  251. 'format': function (data) {
  252. return {
  253. type: 'PUT',
  254. data: JSON.stringify({
  255. "RequestInfo": {
  256. "context": data.context,
  257. "flume_handler": data.agentName
  258. },
  259. "Body": {
  260. "HostRoles": {
  261. "state": data.state
  262. }
  263. }
  264. })
  265. }
  266. }
  267. },
  268. 'reassign.load_configs': {
  269. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  270. 'mock': ''
  271. },
  272. 'reassign.save_configs': {
  273. 'real': '/clusters/{clusterName}',
  274. 'mock': '',
  275. 'type': 'PUT',
  276. 'format': function (data) {
  277. return {
  278. data: JSON.stringify({
  279. Clusters: {
  280. desired_config: {
  281. "type": data.siteName,
  282. "tag": 'version' + (new Date).getTime(),
  283. "properties": data.properties
  284. }
  285. }
  286. })
  287. }
  288. }
  289. },
  290. 'config.cluster_configuration.put': {
  291. 'real': '/clusters/{cluster}',
  292. 'mock': '',
  293. 'format': function(data) {
  294. return {
  295. type: 'PUT',
  296. dataType: 'text',
  297. data: data.data
  298. }
  299. }
  300. },
  301. 'config.advanced': {
  302. 'real': '{stackVersionUrl}/services/{serviceName}/configurations?fields=*',
  303. 'mock': '/data/wizard/stack/hdp/version{stackVersion}/{serviceName}.json'
  304. },
  305. 'config.config_types': {
  306. 'real': '{stackVersionUrl}/services/{serviceName}?fields=StackServices/config_types',
  307. 'mock': ''
  308. },
  309. 'config.tags': {
  310. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  311. 'mock': '/data/clusters/cluster.json'
  312. },
  313. 'config.tags_and_groups': {
  314. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs,config_groups/*{urlParams}',
  315. 'mock': '/data/clusters/tags_and_groups.json'
  316. },
  317. 'config.ambari.database.info': {
  318. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=hostComponents/RootServiceHostComponents/properties/server.jdbc.database,hostComponents/RootServiceHostComponents/properties/server.jdbc.url',
  319. 'mock': ''
  320. },
  321. 'config_groups.all_fields': {
  322. 'real': '/clusters/{clusterName}/config_groups?fields=*',
  323. 'mock': ''
  324. },
  325. 'config_groups.get_config_group_by_id': {
  326. 'real': '/clusters/{clusterName}/config_groups/{id}',
  327. 'mock': ''
  328. },
  329. 'config_groups.update_config_group': {
  330. 'real': '/clusters/{clusterName}/config_groups/{id}',
  331. 'mock': '',
  332. 'type': 'PUT',
  333. 'format': function (data) {
  334. return {
  335. data: JSON.stringify(
  336. [
  337. data.configGroup
  338. ]
  339. )
  340. }
  341. }
  342. },
  343. 'config.on_site': {
  344. 'real': '/clusters/{clusterName}/configurations?{params}',
  345. 'mock': '/data/configurations/cluster_level_configs.json?{params}',
  346. 'format': function() {
  347. return {
  348. async: false
  349. };
  350. }
  351. },
  352. 'config.host_overrides': {
  353. 'real': '/clusters/{clusterName}/configurations?{params}',
  354. 'mock': '/data/configurations/host_level_overrides_configs.json?{params}'
  355. },
  356. 'host.host_component.add_new_component': {
  357. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  358. 'mock': '/data/wizard/deploy/poll_1.json',
  359. 'format': function(data) {
  360. return {
  361. type: 'POST',
  362. data: data.data
  363. }
  364. }
  365. },
  366. 'host.host_component.slave_desired_admin_state': {
  367. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}/?fields=HostRoles/desired_admin_state',
  368. 'mock': ''
  369. },
  370. 'host.host_component.decommission_status': {
  371. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}/?fields=ServiceComponentInfo,host_components/HostRoles/state',
  372. 'mock': ''
  373. },
  374. 'host.host_component.decommission_status_datanode': {
  375. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?fields=metrics/dfs/namenode',
  376. 'mock': ''
  377. },
  378. 'host.host_component.decommission_slave': {
  379. 'real' : '/clusters/{clusterName}/requests',
  380. 'mock' : '',
  381. 'format' : function(data) {
  382. return {
  383. type : 'POST',
  384. data : JSON.stringify({
  385. RequestInfo: {
  386. 'context': data.context,
  387. 'command': data.command,
  388. 'parameters': {
  389. 'slave_type': data.slaveType,
  390. 'excluded_hosts': data.hostName
  391. }
  392. },
  393. "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}]
  394. })
  395. }
  396. }
  397. },
  398. 'host.host_component.recommission_and_restart': {
  399. 'real': '/clusters/{clusterName}/request_schedules',
  400. 'mock': '',
  401. 'format' : function(data) {
  402. return {
  403. type : 'POST',
  404. data : JSON.stringify([ {
  405. "RequestSchedule" : {
  406. "batch" : [ {
  407. "requests" : data.batches
  408. }, {
  409. "batch_settings" : {
  410. "batch_separation_in_seconds" : data.intervalTimeSeconds,
  411. "task_failure_tolerance" : data.tolerateSize
  412. }
  413. } ]
  414. }
  415. } ])
  416. }
  417. }
  418. },
  419. 'host.host_component.refresh_configs': {
  420. 'real':'/clusters/{clusterName}/requests',
  421. 'mock':'',
  422. 'format': function(data) {
  423. return {
  424. type : 'POST',
  425. data : JSON.stringify({
  426. "RequestInfo": {
  427. "command": "CONFIGURE",
  428. "context": data.context
  429. },
  430. "Requests/resource_filters": data.resource_filters
  431. })
  432. }
  433. }
  434. },
  435. 'hosts.metrics': {
  436. 'real': '/clusters/{clusterName}/hosts?fields={metricName}',
  437. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  438. },
  439. 'hosts.metrics.host_component': {
  440. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields=host_components/{metricName}',
  441. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  442. },
  443. 'service.metrics.flume.channel_fill_percent': {
  444. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelFillPercentage[{fromSeconds},{toSeconds},{stepSeconds}]',
  445. 'mock': '/data/services/metrics/flume/channelFillPct.json',
  446. 'testInProduction': true
  447. },
  448. 'service.metrics.flume.channel_size': {
  449. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/*/ChannelSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  450. 'mock': '/data/services/metrics/flume/channelSize.json',
  451. 'testInProduction': true
  452. },
  453. 'service.metrics.flume.sink_drain_success': {
  454. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/*/EventDrainSuccessCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  455. 'mock': '/data/services/metrics/flume/sinkDrainSuccessCount.json',
  456. 'testInProduction': true
  457. },
  458. 'service.metrics.flume.sink_connection_failed': {
  459. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/*/ConnectionFailedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  460. 'mock': '/data/services/metrics/flume/sinkConnectionFailedCount.json',
  461. 'testInProduction': true
  462. },
  463. 'service.metrics.flume.gc': {
  464. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  465. 'mock': '/data/services/metrics/flume/jvmGcTime.json',
  466. 'testInProduction': true
  467. },
  468. 'service.metrics.flume.jvm_heap_used': {
  469. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  470. 'mock': '/data/services/metrics/flume/jvmMemHeapUsedM.json',
  471. 'testInProduction': true
  472. },
  473. 'service.metrics.flume.jvm_threads_runnable': {
  474. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}]',
  475. 'mock': '/data/services/metrics/flume/jvmThreadsRunnable.json',
  476. 'testInProduction': true
  477. },
  478. 'service.metrics.flume.cpu_user': {
  479. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}]',
  480. 'mock': '',
  481. 'testInProduction': true
  482. },
  483. 'service.metrics.flume.source_accepted': {
  484. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SOURCE/*/EventAcceptedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  485. 'mock': '/data/services/metrics/flume/sourceEventAccepted.json',
  486. 'testInProduction': true
  487. },
  488. 'service.metrics.hbase.cluster_requests': {
  489. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/cluster_requests[{fromSeconds},{toSeconds},{stepSeconds}]',
  490. 'mock': '/data/services/metrics/hbase/cluster_requests.json',
  491. 'testInProduction': true
  492. },
  493. 'service.metrics.hbase.hlog_split_size': {
  494. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitSize_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  495. 'mock': '/data/services/metrics/hbase/hlog_split_size.json',
  496. 'testInProduction': true
  497. },
  498. 'service.metrics.hbase.hlog_split_time': {
  499. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  500. 'mock': '/data/services/metrics/hbase/hlog_split_time.json',
  501. 'testInProduction': true
  502. },
  503. 'service.metrics.hbase.regionserver_queuesize': {
  504. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/flushQueueSize[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/compactionQueueSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  505. 'mock': '/data/services/metrics/hbase/regionserver_queuesize.json',
  506. 'testInProduction': true
  507. },
  508. 'service.metrics.hbase.regionserver_regions': {
  509. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/regions[{fromSeconds},{toSeconds},{stepSeconds}]',
  510. 'mock': '/data/services/metrics/hbase/regionserver_regions.json',
  511. 'testInProduction': true
  512. },
  513. 'service.metrics.hbase.regionserver_rw_requests': {
  514. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/readRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/writeRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  515. 'mock': '/data/services/metrics/hbase/regionserver_rw_requests.json',
  516. 'testInProduction': true
  517. },
  518. 'service.metrics.mapreduce.gc': {
  519. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  520. 'mock': '/data/services/metrics/mapreduce/gc.json',
  521. 'testInProduction': true
  522. },
  523. 'service.metrics.mapreduce.jobs_status': {
  524. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/jobs_completed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_preparing[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_failed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_submitted[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_failed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/jobs_running[{fromSeconds},{toSeconds},{stepSeconds}]',
  525. 'mock': '/data/services/metrics/mapreduce/jobs_status.json',
  526. 'testInProduction': true
  527. },
  528. 'service.metrics.mapreduce.jobs_heap': {
  529. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  530. 'mock': '/data/services/metrics/mapreduce/jvm_heap.json',
  531. 'testInProduction': true
  532. },
  533. 'service.metrics.mapreduce.jobs_threads': {
  534. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  535. 'mock': '/data/services/metrics/mapreduce/jvm_threads.json',
  536. 'testInProduction': true
  537. },
  538. 'service.metrics.mapreduce.map_slots': {
  539. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/occupied_map_slots[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/reserved_map_slots[{fromSeconds},{toSeconds},{stepSeconds}]',
  540. 'mock': '/data/services/metrics/mapreduce/map_slots.json',
  541. 'testInProduction': true
  542. },
  543. 'service.metrics.mapreduce.reduce_slots': {
  544. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/occupied_reduce_slots[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/reserved_reduce_slots[{fromSeconds},{toSeconds},{stepSeconds}]',
  545. 'mock': '/data/services/metrics/mapreduce/reduce_slots.json',
  546. 'testInProduction': true
  547. },
  548. 'service.metrics.mapreduce.rpc': {
  549. 'real': '/clusters/{clusterName}/hosts/{jobTrackerNode}/host_components/JOBTRACKER?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  550. 'mock': '/data/services/metrics/mapreduce/rpc.json',
  551. 'testInProduction': true
  552. },
  553. 'service.metrics.mapreduce.tasks_running_waiting': {
  554. 'real': '/clusters/{clusterName}/services/MAPREDUCE/components/JOBTRACKER?fields=metrics/mapred/jobtracker/running_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/running_reduces[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_maps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/mapred/jobtracker/waiting_reduces[{fromSeconds},{toSeconds},{stepSeconds}]',
  555. 'mock': '/data/services/metrics/mapreduce/tasks_running_waiting.json',
  556. 'testInProduction': true
  557. },
  558. 'service.metrics.hdfs.block_status': {
  559. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/PendingReplicationBlocks[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/UnderReplicatedBlocks[{fromSeconds},{toSeconds},{stepSeconds}]',
  560. 'mock': '/data/services/metrics/hdfs/block_status.json',
  561. 'testInProduction': true
  562. },
  563. 'service.metrics.hdfs.file_operations': {
  564. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/namenode/FileInfoOps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/namenode/CreateFileOps[{fromSeconds},{toSeconds},{stepSeconds}]',
  565. 'mock': '/data/services/metrics/hdfs/file_operations.json',
  566. 'testInProduction': true
  567. },
  568. 'service.metrics.hdfs.gc': {
  569. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  570. 'mock': '/data/services/metrics/hdfs/gc.json',
  571. 'testInProduction': true
  572. },
  573. 'service.metrics.hdfs.io': {
  574. 'real': '/clusters/{clusterName}/services/HDFS/components/DATANODE?fields=metrics/dfs/datanode/bytes_written[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/datanode/bytes_read[{fromSeconds},{toSeconds},{stepSeconds}]',
  575. 'mock': '/data/services/metrics/hdfs/io.json',
  576. 'testInProduction': true
  577. },
  578. 'service.metrics.hdfs.jvm_heap': {
  579. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  580. 'mock': '/data/services/metrics/hdfs/jvm_heap.json',
  581. 'testInProduction': true
  582. },
  583. 'service.metrics.hdfs.jvm_threads': {
  584. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  585. 'mock': '/data/services/metrics/hdfs/jvm_threads.json',
  586. 'testInProduction': true
  587. },
  588. 'service.metrics.hdfs.rpc': {
  589. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  590. 'mock': '/data/services/metrics/hdfs/rpc.json',
  591. 'testInProduction': true
  592. },
  593. 'service.metrics.hdfs.space_utilization': {
  594. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/CapacityRemainingGB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityUsedGB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityTotalGB[{fromSeconds},{toSeconds},{stepSeconds}]',
  595. 'mock': '/data/services/metrics/hdfs/space_utilization.json',
  596. 'testInProduction': true
  597. },
  598. 'service.metrics.yarn.gc': {
  599. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  600. 'mock': '/data/services/metrics/yarn/gc.json',
  601. 'testInProduction': true
  602. },
  603. 'service.metrics.yarn.jobs_threads': {
  604. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsBlocked[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsWaiting[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/threadsTimedWaiting[{fromSeconds},{toSeconds},{stepSeconds}]',
  605. 'mock': '/data/services/metrics/yarn/jvm_threads.json',
  606. 'testInProduction': true
  607. },
  608. 'service.metrics.yarn.rpc': {
  609. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  610. 'mock': '/data/services/metrics/yarn/rpc.json',
  611. 'testInProduction': true
  612. },
  613. 'service.metrics.yarn.jobs_heap': {
  614. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/memNonHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memNonHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}],metrics/jvm/memHeapCommittedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  615. 'mock': '/data/services/metrics/yarn/jvm_heap.json',
  616. 'testInProduction': true
  617. },
  618. 'service.metrics.yarn.queue.allocated': {
  619. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AvailableMB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/PendingMB[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AllocatedMB[{fromSeconds},{toSeconds},{stepSeconds}]',
  620. 'mock': '',
  621. 'testInProduction': true
  622. },
  623. 'service.metrics.yarn.queue.allocated.container': {
  624. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AllocatedContainers[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/ReservedContainers[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/PendingContainers[{fromSeconds},{toSeconds},{stepSeconds}]',
  625. 'mock': '',
  626. 'testInProduction': true
  627. },
  628. 'service.metrics.yarn.node.manager.statuses': {
  629. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/ClusterMetrics/NumActiveNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumDecommissionedNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumLostNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumRebootedNMs[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/ClusterMetrics/NumUnhealthyNMs[{fromSeconds},{toSeconds},{stepSeconds}]',
  630. 'mock': '',
  631. 'testInProduction': true
  632. },
  633. 'service.metrics.yarn.queue.memory.resource': {
  634. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=',
  635. 'mock': '',
  636. 'format': function (data, opt) {
  637. var field1 = 'metrics/yarn/Queue/{queueName}/AllocatedMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  638. var field2 = 'metrics/yarn/Queue/{queueName}/AvailableMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  639. if (opt.url != null && data.queueNames != null && data.queueNames.length > 0) {
  640. data.queueNames.forEach(function (q) {
  641. data.queueName = q;
  642. opt.url += (formatUrl(field1, data) + ",");
  643. opt.url += (formatUrl(field2, data) + ",");
  644. });
  645. } else {
  646. opt.url += (formatUrl(field1, data) + ",");
  647. opt.url += (formatUrl(field2, data) + ",");
  648. }
  649. },
  650. 'testInProduction': true
  651. },
  652. 'service.metrics.yarn.queue.apps.states.current': {
  653. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AppsPending[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsRunning[{fromSeconds},{toSeconds},{stepSeconds}]',
  654. 'mock': '',
  655. 'testInProduction': true
  656. },
  657. 'service.metrics.yarn.queue.apps.states.finished': {
  658. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/yarn/Queue/root/AppsKilled[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsFailed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsSubmitted[{fromSeconds},{toSeconds},{stepSeconds}],metrics/yarn/Queue/root/AppsCompleted[{fromSeconds},{toSeconds},{stepSeconds}]',
  659. 'mock': '',
  660. 'testInProduction': true
  661. },
  662. 'service.metrics.storm.nimbus': {
  663. 'real': '/clusters/{clusterName}/services/STORM/components/NIMBUS?fields={metricsTemplate}',
  664. 'mock': ''
  665. },
  666. 'dashboard.cluster_metrics.cpu': {
  667. 'real': '/clusters/{clusterName}/?fields=metrics/cpu[{fromSeconds},{toSeconds},{stepSeconds}]',
  668. 'mock': '/data/cluster_metrics/cpu_1hr.json',
  669. 'testInProduction': true
  670. },
  671. 'dashboard.cluster_metrics.load': {
  672. 'real': '/clusters/{clusterName}/?fields=metrics/load[{fromSeconds},{toSeconds},{stepSeconds}]',
  673. 'mock': '/data/cluster_metrics/load_1hr.json',
  674. 'testInProduction': true
  675. },
  676. 'dashboard.cluster_metrics.memory': {
  677. 'real': '/clusters/{clusterName}/?fields=metrics/memory[{fromSeconds},{toSeconds},{stepSeconds}]',
  678. 'mock': '/data/cluster_metrics/memory_1hr.json',
  679. 'testInProduction': true
  680. },
  681. 'dashboard.cluster_metrics.network': {
  682. 'real': '/clusters/{clusterName}/?fields=metrics/network[{fromSeconds},{toSeconds},{stepSeconds}]',
  683. 'mock': '/data/cluster_metrics/network_1hr.json',
  684. 'testInProduction': true
  685. },
  686. 'host.metrics.cpu': {
  687. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_wio[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_nice[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_aidle[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_system[{fromSeconds},{toSeconds},{stepSeconds}],metrics/cpu/cpu_idle[{fromSeconds},{toSeconds},{stepSeconds}]',
  688. 'mock': '/data/hosts/metrics/cpu.json',
  689. 'testInProduction': true
  690. },
  691. 'host.metrics.disk': {
  692. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/disk/disk_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/disk_free[{fromSeconds},{toSeconds},{stepSeconds}]',
  693. 'mock': '/data/hosts/metrics/disk.json',
  694. 'testInProduction': true
  695. },
  696. 'host.metrics.load': {
  697. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/load/load_fifteen[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_one[{fromSeconds},{toSeconds},{stepSeconds}],metrics/load/load_five[{fromSeconds},{toSeconds},{stepSeconds}]',
  698. 'mock': '/data/hosts/metrics/load.json',
  699. 'testInProduction': true
  700. },
  701. 'host.metrics.memory': {
  702. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/memory/swap_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_shared[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_free[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_cached[{fromSeconds},{toSeconds},{stepSeconds}],metrics/memory/mem_buffers[{fromSeconds},{toSeconds},{stepSeconds}]',
  703. 'mock': '/data/hosts/metrics/memory.json',
  704. 'testInProduction': true
  705. },
  706. 'host.metrics.network': {
  707. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/network/bytes_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/bytes_out[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_in[{fromSeconds},{toSeconds},{stepSeconds}],metrics/network/pkts_out[{fromSeconds},{toSeconds},{stepSeconds}]',
  708. 'mock': '/data/hosts/metrics/network.json',
  709. 'testInProduction': true
  710. },
  711. 'host.metrics.processes': {
  712. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/process/proc_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/process/proc_run[{fromSeconds},{toSeconds},{stepSeconds}]',
  713. 'mock': '/data/hosts/metrics/processes.json',
  714. 'testInProduction': true
  715. },
  716. 'admin.security_status': {
  717. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  718. 'mock': '',
  719. 'format': function() {
  720. return {
  721. timeout: 10000
  722. };
  723. }
  724. },
  725. 'settings.get.user_pref': {
  726. 'real': '/persist/{key}',
  727. 'mock': '/data/user_settings/{key}.json'
  728. },
  729. 'settings.post.user_pref': {
  730. 'real': '/persist',
  731. 'mock': '',
  732. 'type': 'POST',
  733. 'format': function (data) {
  734. return {
  735. data: JSON.stringify(data.keyValuePair)
  736. }
  737. }
  738. },
  739. 'cluster.load_cluster_name': {
  740. 'real': '/clusters',
  741. 'mock': '/data/clusters/info.json'
  742. },
  743. 'cluster.update_upgrade_version': {
  744. 'real': '/stacks/HDP/versions?fields=stackServices/StackServices,Versions',
  745. 'mock': '/data/wizard/stack/stacks.json'
  746. },
  747. 'cluster.load_repositories': {
  748. 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems?fields=repositories/*',
  749. 'mock': '',
  750. 'format': function (data) {
  751. return {
  752. data: data.data
  753. };
  754. }
  755. },
  756. 'admin.high_availability.polling': {
  757. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/*,Requests/*',
  758. 'mock': ''
  759. },
  760. 'admin.high_availability.getNnCheckPointStatus': {
  761. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE',
  762. 'mock': ''
  763. },
  764. 'admin.high_availability.getJnCheckPointStatus': {
  765. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics',
  766. 'mock': ''
  767. },
  768. 'admin.high_availability.getHostComponent': {
  769. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  770. 'mock': ''
  771. },
  772. 'admin.high_availability.create_component': {
  773. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  774. 'mock': '',
  775. 'type': 'POST',
  776. 'format': function (data) {
  777. return {
  778. data: JSON.stringify({
  779. "host_components": [
  780. {
  781. "HostRoles": {
  782. "component_name": data.componentName
  783. }
  784. }
  785. ]
  786. })
  787. }
  788. }
  789. },
  790. 'admin.high_availability.load_configs': {
  791. 'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})',
  792. 'mock': ''
  793. },
  794. 'admin.high_availability.save_configs': {
  795. 'real': '/clusters/{clusterName}',
  796. 'mock': '',
  797. 'type': 'PUT',
  798. 'format': function (data) {
  799. return {
  800. data: JSON.stringify({
  801. Clusters: {
  802. desired_config: {
  803. "type": data.siteName,
  804. "tag": 'version' + (new Date).getTime(),
  805. "properties": data.properties
  806. }
  807. }
  808. })
  809. }
  810. }
  811. },
  812. 'admin.high_availability.load_hbase_configs': {
  813. 'real': '/clusters/{clusterName}/configurations?type=hbase-site&tag={hbaseSiteTag}',
  814. 'mock': ''
  815. },
  816. 'admin.security.cluster_configs': {
  817. 'real': '/clusters/{clusterName}',
  818. 'mock': '',
  819. 'format': function() {
  820. return {
  821. timeout: 10000
  822. };
  823. }
  824. },
  825. 'admin.get.all_configurations': {
  826. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  827. 'mock': '',
  828. 'format': function() {
  829. return {
  830. timeout: 10000
  831. };
  832. }
  833. },
  834. 'admin.security.apply_configurations': {
  835. 'real': '/clusters/{clusterName}',
  836. 'mock': '',
  837. 'format': function (data) {
  838. return {
  839. type: 'PUT',
  840. timeout: 10000,
  841. data: data.configData
  842. };
  843. }
  844. },
  845. 'admin.security.add.cluster_configs': {
  846. 'real': '/clusters/{clusterName}' + '?fields=Clusters/desired_configs',
  847. 'mock': '',
  848. 'format': function() {
  849. return {
  850. timeout: 10000
  851. };
  852. }
  853. },
  854. 'admin.stack_upgrade.run_upgrade': {
  855. 'real': '/clusters/{clusterName}',
  856. 'mock': '',
  857. 'format': function (data) {
  858. return {
  859. type: 'PUT',
  860. data: data.data
  861. };
  862. }
  863. },
  864. 'admin.user.create': {
  865. 'real': '/users/{user}',
  866. 'mock': '/data/users/users.json',
  867. 'format': function(data) {
  868. return {
  869. type: 'POST',
  870. data: JSON.stringify(data.data)
  871. }
  872. }
  873. },
  874. 'admin.user.edit': {
  875. 'real': '/users/{user}',
  876. 'mock':'/data/users/users.json',
  877. 'format': function(data) {
  878. return {
  879. type: 'PUT',
  880. data: data.data
  881. }
  882. }
  883. },
  884. 'admin.stack_upgrade.do_poll': {
  885. 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/*',
  886. 'mock': '/data/wizard/{mock}'
  887. },
  888. 'wizard.advanced_repositories.valid_url': {
  889. 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems/{osType}/repositories/{repoId}',
  890. 'mock': '',
  891. 'type': 'PUT',
  892. 'format': function (data) {
  893. return {
  894. data: JSON.stringify(data.data)
  895. }
  896. }
  897. },
  898. 'wizard.service_components': {
  899. 'real': '{stackUrl}/services?fields=StackServices/*,serviceComponents/*',
  900. 'mock': '/data/stacks/HDP-2.1/service_components.json',
  901. 'format': function(data) {
  902. return {
  903. timeout: 10000,
  904. async: !!data.async
  905. };
  906. }
  907. },
  908. 'wizard.step9.installer.get_host_status': {
  909. 'real': '/clusters/{cluster}/hosts?fields=Hosts/host_state,host_components/HostRoles/state',
  910. 'mock': '/data/wizard/deploy/5_hosts/get_host_state.json'
  911. },
  912. 'wizard.step9.load_log': {
  913. 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/Tasks/command,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true',
  914. 'mock': '/data/wizard/deploy/5_hosts/poll_{numPolls}.json',
  915. 'format': function () {
  916. return {
  917. dataType: 'text'
  918. };
  919. }
  920. },
  921. 'wizard.step8.existing_cluster_names': {
  922. 'real': '/clusters',
  923. 'mock': ''
  924. },
  925. 'wizard.step8.create_cluster': {
  926. 'real':'/clusters/{cluster}',
  927. 'mock':'',
  928. 'format': function(data) {
  929. return {
  930. type: 'POST',
  931. dataType: 'text',
  932. data: data.data
  933. }
  934. }
  935. },
  936. 'wizard.step8.create_selected_services': {
  937. 'real':'/clusters/{cluster}/services',
  938. 'mock':'',
  939. 'format': function(data) {
  940. return {
  941. type: 'POST',
  942. dataType: 'text',
  943. data: data.data
  944. }
  945. }
  946. },
  947. 'wizard.step8.create_components': {
  948. 'real':'/clusters/{cluster}/services?ServiceInfo/service_name={serviceName}',
  949. 'mock':'',
  950. 'format': function(data) {
  951. return {
  952. type: 'POST',
  953. dataType: 'text',
  954. data: data.data
  955. }
  956. }
  957. },
  958. 'wizard.step8.register_host_to_cluster': {
  959. 'real':'/clusters/{cluster}/hosts',
  960. 'mock':'',
  961. 'format': function(data) {
  962. return {
  963. type: 'POST',
  964. dataType: 'text',
  965. data: data.data
  966. }
  967. }
  968. },
  969. 'wizard.step8.register_host_to_component': {
  970. 'real':'/clusters/{cluster}/hosts',
  971. 'mock':'',
  972. 'format': function(data) {
  973. return {
  974. type: 'POST',
  975. dataType: 'text',
  976. data: data.data
  977. }
  978. }
  979. },
  980. 'wizard.step8.apply_configuration_to_cluster': {
  981. 'real':'/clusters/{cluster}',
  982. 'mock':'',
  983. 'format': function(data) {
  984. return {
  985. type: 'PUT',
  986. dataType: 'text',
  987. data: data.data
  988. }
  989. }
  990. },
  991. 'wizard.step8.apply_configuration_groups': {
  992. 'real':'/clusters/{cluster}/config_groups',
  993. 'mock':'',
  994. 'format': function(data) {
  995. return {
  996. type: 'POST',
  997. dataType: 'text',
  998. data: data.data
  999. }
  1000. }
  1001. },
  1002. 'wizard.step8.set_local_repos': {
  1003. 'real':'{stackVersionURL}/operating_systems/{osType}/repositories/{repoId}',
  1004. 'mock':'',
  1005. 'format': function(data) {
  1006. return {
  1007. type: 'PUT',
  1008. dataType: 'text',
  1009. data: data.data
  1010. }
  1011. }
  1012. },
  1013. 'wizard.step3.jdk_check': {
  1014. 'real': '/requests',
  1015. 'mock': '',
  1016. 'format': function (data) {
  1017. return {
  1018. type: 'POST',
  1019. data: JSON.stringify({
  1020. "RequestInfo": {
  1021. "context": "Check hosts",
  1022. "action": "check_host",
  1023. "parameters" : {
  1024. "threshold" : "60",
  1025. "java_home" : data.java_home,
  1026. "jdk_location": data.jdk_location,
  1027. "check_execute_list" : "java_home_check"
  1028. }
  1029. },
  1030. "Requests/resource_filters": [{
  1031. "hosts": data.host_names
  1032. }]
  1033. })
  1034. }
  1035. }
  1036. },
  1037. 'wizard.step3.jdk_check.get_results': {
  1038. 'real': '/requests/{requestIndex}?fields=*,tasks/Tasks/host_name,tasks/Tasks/status,tasks/Tasks/structured_out',
  1039. 'mock': '/data/requests/host_check/jdk_check_results.json'
  1040. },
  1041. 'wizard.step3.host_info': {
  1042. 'real': '/hosts?fields=Hosts/total_mem,Hosts/cpu_count,Hosts/disk_info,Hosts/last_agent_env,Hosts/host_name,Hosts/os_type,Hosts/os_arch,Hosts/ip',
  1043. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1044. 'format': function() {
  1045. return {
  1046. contentType: 'application/json'
  1047. };
  1048. }
  1049. },
  1050. 'preinstalled.checks': {
  1051. 'real':'/requests',
  1052. 'mock':'',
  1053. 'format': function(data) {
  1054. return {
  1055. type : 'POST',
  1056. data : JSON.stringify({
  1057. "RequestInfo": data.RequestInfo,
  1058. "Requests/resource_filters": [data.resource_filters]
  1059. })
  1060. }
  1061. }
  1062. },
  1063. 'preinstalled.checks.tasks': {
  1064. 'real':'/requests/{requestId}?fields=tasks/Tasks',
  1065. 'mock':'/data/requests/host_check/1.json'
  1066. },
  1067. 'wizard.step3.rerun_checks': {
  1068. 'real': '/hosts?fields=Hosts/last_agent_env',
  1069. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1070. 'format': function() {
  1071. return {
  1072. contentType: 'application/json'
  1073. };
  1074. }
  1075. },
  1076. 'wizard.step3.bootstrap': {
  1077. 'real': '/bootstrap/{bootRequestId}',
  1078. 'mock': '/data/wizard/bootstrap/poll_{numPolls}.json'
  1079. },
  1080. 'wizard.step3.is_hosts_registered': {
  1081. 'real': '/hosts',
  1082. 'mock': '/data/wizard/bootstrap/single_host_registration.json'
  1083. },
  1084. 'wizard.stacks': {
  1085. 'real': '/stacks',
  1086. 'mock': '/data/wizard/stack/stacks2.json',
  1087. 'format': function() {
  1088. return {
  1089. async: false
  1090. };
  1091. }
  1092. },
  1093. 'wizard.stacks_versions': {
  1094. 'real': '/stacks/{stackName}/versions?fields=Versions,operatingSystems/repositories/Repositories',
  1095. 'mock': '/data/wizard/stack/{stackName}_versions.json',
  1096. 'format': function() {
  1097. return {
  1098. async: false
  1099. };
  1100. }
  1101. },
  1102. 'wizard.launch_bootstrap': {
  1103. 'real': '/bootstrap',
  1104. 'mock': '/data/wizard/bootstrap/bootstrap.json',
  1105. 'type': 'POST',
  1106. 'format': function (data) {
  1107. return {
  1108. contentType: 'application/json',
  1109. data: data.bootStrapData,
  1110. popup: data.popup
  1111. }
  1112. }
  1113. },
  1114. 'router.login': {
  1115. 'real': '/users/{loginName}',
  1116. 'mock': '/data/users/user_{usr}.json',
  1117. 'format': function (data) {
  1118. var statusCode = jQuery.extend({}, require('data/statusCodes'));
  1119. statusCode['403'] = function () {
  1120. console.log("Error code 403: Forbidden.");
  1121. };
  1122. return {
  1123. statusCode: statusCode
  1124. };
  1125. }
  1126. },
  1127. 'router.login2': {
  1128. 'real': '/clusters',
  1129. 'mock': '/data/clusters/info.json'
  1130. },
  1131. 'router.logoff': {
  1132. 'real': '/logout',
  1133. 'mock': ''
  1134. },
  1135. 'router.authentication': {
  1136. 'real': '/clusters',
  1137. 'mock': '/data/clusters/info.json',
  1138. 'format': function() {
  1139. return {
  1140. async: false
  1141. };
  1142. }
  1143. },
  1144. 'ambari.service.load_jdk_name': {
  1145. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/jdk.name,RootServiceComponents/properties/java.home,RootServiceComponents/properties/jdk_location',
  1146. 'mock': '/data/requests/host_check/jdk_name.json'
  1147. },
  1148. 'ambari.service.load_server_version': {
  1149. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/component_version',
  1150. 'mock': ''
  1151. },
  1152. 'ambari.service': {
  1153. 'real': '/services/AMBARI/components/AMBARI_SERVER',
  1154. 'mock': '/data/services/ambari_server.json'
  1155. },
  1156. 'ambari.service.load_server_clock': {
  1157. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/server_clock',
  1158. 'mock': ''
  1159. },
  1160. 'config_groups.create': {
  1161. 'real': '/clusters/{clusterName}/config_groups',
  1162. 'mock': '',
  1163. 'format': function (data) {
  1164. return {
  1165. type: 'POST',
  1166. data: JSON.stringify([{
  1167. "ConfigGroup": {
  1168. "group_name": data.group_name,
  1169. "tag": data.service_id,
  1170. "description": data.description,
  1171. "desired_configs": data.desired_configs,
  1172. "hosts": data.hosts
  1173. }
  1174. }])
  1175. }
  1176. }
  1177. },
  1178. 'config_groups.update': {
  1179. 'real': '/clusters/{clusterName}/config_groups/{id}',
  1180. 'mock': '',
  1181. 'format': function (data) {
  1182. return {
  1183. type: 'PUT',
  1184. data: JSON.stringify(data.data)
  1185. }
  1186. }
  1187. },
  1188. 'rolling_restart.post': {
  1189. 'real': '/clusters/{clusterName}/request_schedules',
  1190. 'mock': '',
  1191. 'format' : function(data) {
  1192. return {
  1193. type : 'POST',
  1194. data : JSON.stringify([ {
  1195. "RequestSchedule" : {
  1196. "batch" : [ {
  1197. "requests" : data.batches
  1198. }, {
  1199. "batch_settings" : {
  1200. "batch_separation_in_seconds" : data.intervalTimeSeconds,
  1201. "task_failure_tolerance" : data.tolerateSize
  1202. }
  1203. } ]
  1204. }
  1205. } ])
  1206. }
  1207. }
  1208. },
  1209. 'request_schedule.get': {
  1210. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  1211. 'mock': ''
  1212. },
  1213. 'restart.hostComponents': {
  1214. 'real':'/clusters/{clusterName}/requests',
  1215. 'mock':'',
  1216. 'format': function(data) {
  1217. return {
  1218. type : 'POST',
  1219. data : JSON.stringify({
  1220. "RequestInfo": {
  1221. "command": "RESTART",
  1222. "context": data.context,
  1223. "operation_level": data.operation_level
  1224. },
  1225. "Requests/resource_filters": data.resource_filters
  1226. })
  1227. }
  1228. }
  1229. },
  1230. 'mirroring.get_all_entities': {
  1231. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/list/{type}?fields=status&user.name=ambari-qa',
  1232. 'mock': '/data/mirroring/{type}s.xml',
  1233. 'apiPrefix': '',
  1234. 'format': function () {
  1235. return {
  1236. dataType: 'xml'
  1237. }
  1238. }
  1239. },
  1240. 'mirroring.get_definition': {
  1241. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/definition/{type}/{name}?user.name=ambari-qa',
  1242. 'mock': '/data/mirroring/{name}_definition.xml',
  1243. 'apiPrefix': '',
  1244. 'format': function () {
  1245. return {
  1246. cache: true,
  1247. dataType: 'xml'
  1248. }
  1249. }
  1250. },
  1251. 'mirroring.dataset.get_all_instances': {
  1252. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/status/feed/{dataset}?start={start}&end={end}&user.name=ambari-qa',
  1253. 'mock': '/data/mirroring/{dataset}_instances.json',
  1254. 'apiPrefix': ''
  1255. },
  1256. 'mirroring.create_new_dataset': {
  1257. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/submitAndSchedule/feed?user.name=ambari-qa',
  1258. 'mock': '/data/mirroring/succeeded.json',
  1259. 'apiPrefix': '',
  1260. 'type': 'POST',
  1261. 'format': function (data) {
  1262. return {
  1263. contentType: 'text/xml',
  1264. dataType: 'xml',
  1265. data: data.entity,
  1266. headers: {
  1267. 'AmbariProxy-Content-Type': 'text/xml'
  1268. }
  1269. }
  1270. }
  1271. },
  1272. 'mirroring.submit_entity': {
  1273. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/submit/{type}?user.name=ambari-qa',
  1274. 'mock': '/data/mirroring/succeeded.json',
  1275. 'apiPrefix': '',
  1276. 'type': 'POST',
  1277. 'format': function (data) {
  1278. return {
  1279. contentType: 'text/xml',
  1280. dataType: 'xml',
  1281. data: data.entity,
  1282. headers: {
  1283. 'AmbariProxy-Content-Type': 'text/xml'
  1284. }
  1285. }
  1286. }
  1287. },
  1288. 'mirroring.update_entity': {
  1289. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/update/{type}/{name}?user.name=ambari-qa',
  1290. 'mock': '/data/mirroring/succeeded.json',
  1291. 'apiPrefix': '',
  1292. 'type': 'POST',
  1293. 'format': function (data) {
  1294. return {
  1295. contentType: 'text/xml',
  1296. dataType: 'xml',
  1297. data: data.entity,
  1298. headers: {
  1299. 'AmbariProxy-Content-Type': 'text/xml'
  1300. }
  1301. }
  1302. }
  1303. },
  1304. 'mirroring.delete_entity': {
  1305. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/delete/{type}/{name}?user.name=ambari-qa',
  1306. 'mock': '/data/mirroring/succeeded.json',
  1307. 'apiPrefix': '',
  1308. 'type': 'DELETE',
  1309. 'format': function () {
  1310. return {
  1311. dataType: 'xml'
  1312. }
  1313. }
  1314. },
  1315. 'mirroring.suspend_entity': {
  1316. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/suspend/{type}/{name}?user.name=ambari-qa',
  1317. 'mock': '/data/mirroring/succeeded.json',
  1318. 'apiPrefix': '',
  1319. 'type': 'POST',
  1320. 'format': function (data) {
  1321. return {
  1322. dataType: 'xml',
  1323. data: data.entity
  1324. }
  1325. }
  1326. },
  1327. 'mirroring.resume_entity': {
  1328. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/resume/{type}/{name}?user.name=ambari-qa',
  1329. 'mock': '/data/mirroring/succeeded.json',
  1330. 'apiPrefix': '',
  1331. 'type': 'POST',
  1332. 'format': function () {
  1333. return {
  1334. dataType: 'xml'
  1335. }
  1336. }
  1337. },
  1338. 'mirroring.schedule_entity': {
  1339. 'real': '/proxy?url=http://{falconServer}:15000/api/entities/schedule/{type}/{name}?user.name=ambari-qa',
  1340. 'mock': '/data/mirroring/succeeded.json',
  1341. 'apiPrefix': '',
  1342. 'type': 'POST',
  1343. 'format': function () {
  1344. return {
  1345. dataType: 'xml'
  1346. }
  1347. }
  1348. },
  1349. 'mirroring.suspend_instance': {
  1350. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/suspend/feed/{feed}?start={name}&user.name=ambari-qa',
  1351. 'mock': '/data/mirroring/succeeded.json',
  1352. 'apiPrefix': '',
  1353. 'type': 'POST'
  1354. },
  1355. 'mirroring.resume_instance': {
  1356. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/resume/feed/{feed}?start={name}&user.name=ambari-qa',
  1357. 'mock': '/data/mirroring/succeeded.json',
  1358. 'apiPrefix': '',
  1359. 'type': 'POST'
  1360. },
  1361. 'mirroring.kill_instance': {
  1362. 'real': '/proxy?url=http://{falconServer}:15000/api/instance/kill/feed/{feed}?start={name}&user.name=ambari-qa',
  1363. 'mock': '/data/mirroring/succeeded.json',
  1364. 'apiPrefix': '',
  1365. 'type': 'POST'
  1366. },
  1367. 'bulk_request.decommission': {
  1368. 'real' : '/clusters/{clusterName}/requests',
  1369. 'mock' : '',
  1370. 'format': function(data) {
  1371. return {
  1372. type: 'POST',
  1373. data: JSON.stringify({
  1374. 'RequestInfo': {
  1375. 'context': data.context,
  1376. 'command': 'DECOMMISSION',
  1377. 'parameters': data.parameters,
  1378. 'operation_level': {
  1379. 'level': "CLUSTER",
  1380. 'cluster_name': data.clusterName
  1381. }
  1382. },
  1383. "Requests/resource_filters": [{"service_name" : data.serviceName, "component_name" : data.componentName}]
  1384. })
  1385. }
  1386. }
  1387. },
  1388. 'bulk_request.hosts.passive_state': {
  1389. 'real': '/clusters/{clusterName}/hosts',
  1390. 'mock': '',
  1391. 'format': function(data) {
  1392. return {
  1393. type: 'PUT',
  1394. data: JSON.stringify({
  1395. RequestInfo: {
  1396. context: data.requestInfo,
  1397. query: 'Hosts/host_name.in(' + data.hostNames + ')'
  1398. },
  1399. Body: {
  1400. Hosts: {
  1401. maintenance_state: data.passive_state
  1402. }
  1403. }
  1404. })
  1405. }
  1406. }
  1407. },
  1408. 'bulk_request.hosts.all_components.passive_state': {
  1409. 'real': '/clusters/{clusterName}/host_components',
  1410. 'mock': '',
  1411. 'format': function(data) {
  1412. return {
  1413. type: 'PUT',
  1414. data: JSON.stringify({
  1415. RequestInfo: {
  1416. context: data.requestInfo,
  1417. query: data.query
  1418. },
  1419. Body: {
  1420. HostRoles: {
  1421. maintenance_state: data.passive_state
  1422. }
  1423. }
  1424. })
  1425. }
  1426. }
  1427. },
  1428. 'jobs.lastID': {
  1429. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/HIVE_QUERY_ID?limit=1&secondaryFilter=tez:true',
  1430. 'mock': 'data/jobs/hive-queries.json',
  1431. 'apiPrefix': ''
  1432. },
  1433. 'jobs.tezDag.NametoID': {
  1434. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_DAG_ID?primaryFilter=dagName:{tezDagName}',
  1435. 'mock': '/data/jobs/tezDag-name-to-id.json',
  1436. 'apiPrefix': ''
  1437. },
  1438. 'jobs.tezDag.tezDagId': {
  1439. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_DAG_ID/{tezDagId}?fields=relatedentities,otherinfo',
  1440. 'mock': '/data/jobs/tezDag.json',
  1441. 'apiPrefix': ''
  1442. },
  1443. 'jobs.tezDag.tezDagVertexId': {
  1444. 'real': '/proxy?url=http://{historyServerHostName}:{ahsWebPort}/ws/v1/timeline/TEZ_VERTEX_ID/{tezDagVertexId}?fields=otherinfo',
  1445. 'mock': '/data/jobs/tezDagVertex.json',
  1446. 'apiPrefix': ''
  1447. },
  1448. 'views.info': {
  1449. 'real': '/views',
  1450. 'mock':''
  1451. },
  1452. /**
  1453. * Get all instances of all views across versions
  1454. */
  1455. 'views.instances': {
  1456. 'real': '/views?fields=versions/instances/ViewInstanceInfo,versions/ViewVersionInfo/label',
  1457. 'mock':''
  1458. },
  1459. 'host.host_component.flume.metrics': {
  1460. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*',
  1461. 'mock': ''
  1462. },
  1463. 'host.host_component.flume.metrics.timeseries': {
  1464. 'real': '',
  1465. 'mock': '',
  1466. format: function (data) {
  1467. return {
  1468. url: data.url
  1469. }
  1470. }
  1471. },
  1472. 'host.host_components.filtered': {
  1473. 'real': '/clusters/{clusterName}/hosts?{fields}',
  1474. 'mock': '',
  1475. format: function(data) {
  1476. return {
  1477. headers: {
  1478. 'X-Http-Method-Override': 'GET'
  1479. },
  1480. type: 'POST',
  1481. data: JSON.stringify({
  1482. "RequestInfo": {"query" : data.parameters}
  1483. })
  1484. };
  1485. }
  1486. },
  1487. 'host.status.counters': {
  1488. 'real': '/clusters/{clusterName}?fields=alerts,Clusters/health_report,Clusters/total_hosts&minimal_response=true',
  1489. 'mock': '/data/hosts/HDP2/host_status_counters.json'
  1490. },
  1491. 'components.filter_by_status': {
  1492. 'real': '/clusters/{clusterName}/components?fields=host_components/HostRoles/host_name,ServiceComponentInfo/component_name,ServiceComponentInfo/started_count{urlParams}&minimal_response=true',
  1493. 'mock': ''
  1494. },
  1495. 'hosts.all.install': {
  1496. 'real': '/hosts?minimal_response=true',
  1497. 'mock': ''
  1498. },
  1499. 'hosts.all': {
  1500. 'real': '/clusters/{clusterName}/hosts?minimal_response=true',
  1501. 'mock': ''
  1502. },
  1503. 'hosts.with_public_host_names': {
  1504. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/public_host_name&minimal_response=true',
  1505. 'mock': ''
  1506. },
  1507. 'hosts.for_quick_links': {
  1508. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name.in({masterHosts})&fields=Hosts/public_host_name,host_components/HostRoles/component_name{urlParams}&minimal_response=true',
  1509. 'mock': ''
  1510. },
  1511. 'hosts.confirmed.install': {
  1512. 'real': '/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
  1513. 'mock': ''
  1514. },
  1515. 'hosts.confirmed': {
  1516. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/os_type,Hosts/os_arch,Hosts/ip,host_components/HostRoles/state&minimal_response=true',
  1517. 'mock': ''
  1518. },
  1519. 'host_components.all': {
  1520. 'real': '/clusters/{clusterName}/host_components?fields=HostRoles/host_name&minimal_response=true',
  1521. 'mock': ''
  1522. },
  1523. 'host_components.with_services_names': {
  1524. 'real': '/clusters/{clusterName}/host_components?fields=component/ServiceComponentInfo/service_name,HostRoles/host_name&minimal_response=true',
  1525. 'mock': ''
  1526. },
  1527. 'components.get_installed': {
  1528. 'real': '/clusters/{clusterName}/components',
  1529. 'mock': ''
  1530. },
  1531. 'hosts.heatmaps': {
  1532. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/os_type,Hosts/ip,host_components,metrics/disk,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free&minimal_response=true',
  1533. 'mock': ''
  1534. },
  1535. 'custom_action.create': {
  1536. 'real': '/requests',
  1537. 'mock': '',
  1538. 'format': function(data) {
  1539. var requestInfo = {
  1540. context: 'Check host',
  1541. action: 'check_host',
  1542. parameters: { }
  1543. };
  1544. $.extend(true, requestInfo, data.requestInfo)
  1545. return {
  1546. type: 'POST',
  1547. data: JSON.stringify({
  1548. 'RequestInfo': requestInfo,
  1549. 'Requests/resource_filters': [{
  1550. hosts: data.filteredHosts.join(',')
  1551. }]
  1552. })
  1553. }
  1554. }
  1555. },
  1556. 'custom_action.request': {
  1557. 'real': '/requests/{requestId}/tasks/{taskId}',
  1558. 'mock': '',
  1559. 'format': function(data) {
  1560. return {
  1561. requestId: data.requestId,
  1562. taskId: data.taskId || ''
  1563. }
  1564. }
  1565. },
  1566. 'hosts.high_availability.wizard': {
  1567. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
  1568. 'mock': ''
  1569. },
  1570. 'hosts.security.wizard': {
  1571. 'real': '/clusters/{clusterName}/hosts?fields=host_components/HostRoles/service_name&minimal_response=true',
  1572. 'mock': ''
  1573. },
  1574. 'host_component.installed.on_hosts': {
  1575. 'real': '/clusters/{clusterName}/host_components?HostRoles/component_name={componentName}&HostRoles/host_name.in({hostNames})&fields=HostRoles/host_name&minimal_response=true',
  1576. 'mock': ''
  1577. },
  1578. 'hosts.by_component.one': {
  1579. 'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({componentNames})&fields=host_components,Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name&page_size=1&minimal_response=true',
  1580. 'mock': ''
  1581. },
  1582. 'hosts.by_component.all': {
  1583. 'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name.in({componentNames})&fields=host_components,Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name&minimal_response=true',
  1584. 'mock': ''
  1585. },
  1586. 'hosts.config_groups': {
  1587. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name,host_components&minimal_response=true',
  1588. 'mock': ''
  1589. },
  1590. 'cluster.fields': {
  1591. real: '/clusters/{clusterName}?fields={fields}',
  1592. mock: '',
  1593. format: function(data) {
  1594. return {
  1595. async: true,
  1596. fields: data.fields.join(',')
  1597. }
  1598. }
  1599. },
  1600. 'hosts.host_components.pre_load': {
  1601. real: '',
  1602. mock: '',
  1603. format: function(data) {
  1604. return {
  1605. url: data.url
  1606. }
  1607. }
  1608. },
  1609. 'hosts.bulk.operations': {
  1610. real: '/clusters/{clusterName}/hosts?fields=Hosts/host_name,Hosts/maintenance_state,' +
  1611. 'host_components/HostRoles/state,host_components/HostRoles/maintenance_state,' +
  1612. 'host_components/HostRoles/stale_configs&minimal_response=true',
  1613. mock: '',
  1614. format: function(data) {
  1615. return {
  1616. headers: {
  1617. 'X-Http-Method-Override': 'GET'
  1618. },
  1619. type: 'POST',
  1620. data: JSON.stringify({
  1621. "RequestInfo": {"query" : data.parameters }
  1622. })
  1623. }
  1624. }
  1625. }
  1626. };
  1627. /**
  1628. * Replace data-placeholders to its values
  1629. *
  1630. * @param {String} url
  1631. * @param {Object} data
  1632. * @return {String}
  1633. */
  1634. var formatUrl = function (url, data) {
  1635. if (!url) return null;
  1636. var keys = url.match(/\{\w+\}/g);
  1637. keys = (keys === null) ? [] : keys;
  1638. if (keys) {
  1639. keys.forEach(function (key) {
  1640. var raw_key = key.substr(1, key.length - 2);
  1641. var replace;
  1642. if (!data || !data[raw_key]) {
  1643. replace = '';
  1644. }
  1645. else {
  1646. replace = data[raw_key];
  1647. }
  1648. url = url.replace(new RegExp(key, 'g'), replace);
  1649. });
  1650. }
  1651. return url;
  1652. };
  1653. /**
  1654. * this = object from config
  1655. * @return {Object}
  1656. */
  1657. var formatRequest = function (data) {
  1658. var opt = {
  1659. type: this.type || 'GET',
  1660. timeout: App.timeout,
  1661. dataType: 'json',
  1662. statusCode: require('data/statusCodes')
  1663. };
  1664. if (App.get('testMode')) {
  1665. opt.url = formatUrl(this.mock ? this.mock : '', data);
  1666. opt.type = 'GET';
  1667. }
  1668. else {
  1669. var prefix = this.apiPrefix != null ? this.apiPrefix : App.apiPrefix;
  1670. opt.url = prefix + formatUrl(this.real, data);
  1671. }
  1672. if (this.format) {
  1673. jQuery.extend(opt, this.format(data, opt));
  1674. }
  1675. return opt;
  1676. };
  1677. /**
  1678. * Wrapper for all ajax requests
  1679. *
  1680. * @type {Object}
  1681. */
  1682. var ajax = Em.Object.extend({
  1683. /**
  1684. * Send ajax request
  1685. *
  1686. * @param {Object} config
  1687. * @return {$.ajax} jquery ajax object
  1688. *
  1689. * config fields:
  1690. * name - url-key in the urls-object *required*
  1691. * sender - object that send request (need for proper callback initialization) *required*
  1692. * data - object with data for url-format
  1693. * beforeSend - method-name for ajax beforeSend response callback
  1694. * success - method-name for ajax success response callback
  1695. * error - method-name for ajax error response callback
  1696. * callback - callback from <code>App.updater.run</code> library
  1697. */
  1698. send: function (config) {
  1699. if (!config.sender) {
  1700. console.warn('Ajax sender should be defined!');
  1701. return null;
  1702. }
  1703. // default parameters
  1704. var params = {
  1705. clusterName: App.get('clusterName')
  1706. };
  1707. // extend default parameters with provided
  1708. if (config.data) {
  1709. jQuery.extend(params, config.data);
  1710. }
  1711. var opt = {};
  1712. if (!urls[config.name]) {
  1713. console.warn('Invalid name provided!');
  1714. return null;
  1715. }
  1716. opt = formatRequest.call(urls[config.name], params);
  1717. opt.context = this;
  1718. // object sender should be provided for processing beforeSend, success and error responses
  1719. opt.beforeSend = function (xhr) {
  1720. if (config.beforeSend) {
  1721. config.sender[config.beforeSend](opt, xhr, params);
  1722. }
  1723. };
  1724. opt.success = function (data) {
  1725. console.log("TRACE: The url is: " + opt.url);
  1726. if (config.success) {
  1727. config.sender[config.success](data, opt, params);
  1728. }
  1729. };
  1730. opt.error = function (request, ajaxOptions, error) {
  1731. if (config.error) {
  1732. config.sender[config.error](request, ajaxOptions, error, opt, params);
  1733. } else {
  1734. this.defaultErrorHandler(request, opt.url, opt.type);
  1735. }
  1736. };
  1737. opt.complete = function () {
  1738. if (config.callback) {
  1739. config.callback();
  1740. }
  1741. };
  1742. if ($.mocho) {
  1743. opt.url = 'http://' + $.hostName + opt.url;
  1744. }
  1745. return $.ajax(opt);
  1746. },
  1747. // A single instance of App.ModalPopup view
  1748. modalPopup: null,
  1749. /**
  1750. * defaultErrorHandler function is referred from App.ajax.send function and App.HttpClient.defaultErrorHandler function
  1751. * @jqXHR {jqXHR Object}
  1752. * @url {string}
  1753. * @method {String} Http method
  1754. * @showStatus {number} HTTP response code which should be shown. Default is 500.
  1755. */
  1756. defaultErrorHandler: function (jqXHR, url, method, showStatus) {
  1757. method = method || 'GET';
  1758. var self = this;
  1759. var api = " received on " + method + " method for API: " + url;
  1760. try {
  1761. var json = $.parseJSON(jqXHR.responseText);
  1762. var message = json.message;
  1763. } catch (err) {
  1764. }
  1765. if (!showStatus) {
  1766. showStatus = 500;
  1767. }
  1768. var statusCode = jqXHR.status + " status code";
  1769. if (jqXHR.status === showStatus && !this.modalPopup) {
  1770. this.modalPopup = App.ModalPopup.show({
  1771. header: jqXHR.statusText,
  1772. secondary: false,
  1773. onPrimary: function () {
  1774. this.hide();
  1775. self.modalPopup = null;
  1776. },
  1777. bodyClass: Ember.View.extend({
  1778. classNames: ['api-error'],
  1779. templateName: require('templates/utils/ajax'),
  1780. api: api,
  1781. statusCode: statusCode,
  1782. message: message,
  1783. showMessage: !!message
  1784. })
  1785. });
  1786. }
  1787. }
  1788. });
  1789. /**
  1790. * Add few access-methods for test purposes
  1791. */
  1792. if ($.mocho) {
  1793. ajax.reopen({
  1794. /**
  1795. * Don't use it anywhere except tests!
  1796. * @returns {Array}
  1797. */
  1798. fakeGetUrlNames: function() {
  1799. return Em.keys(urls);
  1800. },
  1801. /**
  1802. * Don't use it anywhere except tests!
  1803. * @param name
  1804. * @returns {*}
  1805. */
  1806. fakeGetUrl: function(name) {
  1807. return urls[name];
  1808. },
  1809. /**
  1810. * Don't use it anywhere except tests!
  1811. * @param url
  1812. * @param data
  1813. * @returns {String}
  1814. */
  1815. fakeFormatUrl: function(url, data) {
  1816. return formatUrl(url, data);
  1817. },
  1818. /**
  1819. * Don't use it anywhere except tests!
  1820. * @param urlObj
  1821. * @param data
  1822. * @returns {Object}
  1823. */
  1824. fakeFormatRequest: function(urlObj, data) {
  1825. return formatRequest.call(urlObj, data);
  1826. }
  1827. });
  1828. }
  1829. App.ajax = ajax.create({});