ajax.js 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653
  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.cluster.update' : {
  33. 'type': 'PUT',
  34. 'real': '/clusters/{clusterName}',
  35. 'mock': '/data/wizard/deploy/poll_1.json',
  36. 'format': function (data) {
  37. return {
  38. data: JSON.stringify(data.data)
  39. };
  40. }
  41. },
  42. 'common.services.update' : {
  43. 'real': '/clusters/{clusterName}/services?{urlParams}',
  44. 'mock': '/data/wizard/deploy/poll_1.json',
  45. 'format': function (data) {
  46. return {
  47. type: 'PUT',
  48. data: JSON.stringify({
  49. RequestInfo: {
  50. "context": data.context,
  51. "operation_level": {
  52. "level": "CLUSTER",
  53. "cluster_name" : data.clusterName
  54. }
  55. },
  56. Body: {
  57. ServiceInfo: data.ServiceInfo
  58. }
  59. })
  60. };
  61. }
  62. },
  63. 'common.service.update' : {
  64. 'real': '/clusters/{clusterName}/services/{serviceName}',
  65. 'mock': '/data/wizard/deploy/poll_1.json',
  66. 'format': function (data) {
  67. return {
  68. type: 'PUT',
  69. data: JSON.stringify({
  70. RequestInfo: {
  71. "context": data.context,
  72. "operation_level": {
  73. "level": "SERVICE",
  74. "cluster_name" : data.clusterName,
  75. "service_name" : data.serviceName
  76. }
  77. },
  78. Body: {
  79. ServiceInfo: data.ServiceInfo
  80. }
  81. })
  82. };
  83. }
  84. },
  85. 'common.service_component.info' : {
  86. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?{urlParams}',
  87. 'mock': '/data/wizard/deploy/poll_1.json'
  88. },
  89. 'common.host_component.update': {
  90. 'real': '/clusters/{clusterName}/host_components',
  91. 'mock': '',
  92. 'type': 'PUT',
  93. 'format': function (data) {
  94. return {
  95. data: JSON.stringify({
  96. RequestInfo: {
  97. context: data.context,
  98. query: data.query
  99. },
  100. Body: {
  101. "HostRoles": data.HostRoles
  102. }
  103. })
  104. }
  105. }
  106. },
  107. 'common.host.host_components.update': {
  108. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components?{urlParams}',
  109. 'mock': '',
  110. 'type': 'PUT',
  111. 'format': function (data) {
  112. return {
  113. data: JSON.stringify({
  114. RequestInfo: {
  115. "context": data.context,
  116. "operation_level": {
  117. level: "HOST",
  118. cluster_name: data.clusterName,
  119. host_names: data.hostName
  120. },
  121. query: data.query
  122. },
  123. Body: {
  124. "HostRoles": data.HostRoles
  125. }
  126. })
  127. }
  128. }
  129. },
  130. 'common.host.host_component.update': {
  131. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?{urlParams}',
  132. 'mock': '/data/wizard/deploy/2_hosts/poll_9.json',
  133. 'type': 'PUT',
  134. 'format': function (data) {
  135. return {
  136. data: JSON.stringify({
  137. RequestInfo: {
  138. "context": data.context,
  139. "operation_level": {
  140. level: "HOST_COMPONENT",
  141. cluster_name: data.clusterName,
  142. host_name: data.hostName,
  143. service_name: data.serviceName || null
  144. }
  145. },
  146. Body: {
  147. "HostRoles": data.HostRoles
  148. }
  149. })
  150. }
  151. }
  152. },
  153. 'common.service.configurations': {
  154. 'real':'/clusters/{clusterName}',
  155. 'mock':'',
  156. 'format': function (data) {
  157. return {
  158. type: 'PUT',
  159. data: JSON.stringify({
  160. Clusters: {
  161. desired_config: data.desired_config
  162. }
  163. })
  164. }
  165. }
  166. },
  167. 'common.across.services.configurations': {
  168. 'type': 'PUT',
  169. 'real':'/clusters/{clusterName}',
  170. 'mock':'/data/services/ambari.json',
  171. 'format': function(data) {
  172. return {
  173. dataType: 'text',
  174. data: data.data
  175. }
  176. }
  177. },
  178. 'common.request.polling': {
  179. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/Tasks/request_id,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,tasks/Tasks/structured_out,Requests/*&tasks/Tasks/stage_id={stageId}',
  180. 'mock': '/data/background_operations/host_upgrade_tasks.json'
  181. },
  182. 'service.ambari': {
  183. 'real': '/services/AMBARI?fields=components/RootServiceComponents',
  184. 'mock': '/data/services/ambari.json'
  185. },
  186. 'service.flume.agent.command': {
  187. 'real': '/clusters/{clusterName}/hosts/{host}/host_components/FLUME_HANDLER',
  188. 'mock': '',
  189. 'format': function (data) {
  190. return {
  191. type: 'PUT',
  192. data: JSON.stringify({
  193. "RequestInfo": {
  194. "context": data.context,
  195. "flume_handler": data.agentName,
  196. "operation_level": {
  197. level: "HOST_COMPONENT",
  198. cluster_name: data.clusterName,
  199. service_name: "FLUME",
  200. host_name: data.host
  201. }
  202. },
  203. "Body": {
  204. "HostRoles": {
  205. "state": data.state
  206. }
  207. }
  208. })
  209. }
  210. }
  211. },
  212. 'common.host_components.update': {
  213. 'real': '/clusters/{clusterName}/host_components?{urlParams}',
  214. 'mock': '/data/wizard/deploy/poll_1.json',
  215. 'type': 'PUT',
  216. 'format': function (data) {
  217. return {
  218. data: JSON.stringify({
  219. RequestInfo: {
  220. "context": data.context,
  221. "operation_level": {
  222. level: data.level || "CLUSTER",
  223. cluster_name: data.clusterName
  224. },
  225. query: data.query
  226. },
  227. Body: {
  228. "HostRoles": data.HostRoles
  229. }
  230. })
  231. }
  232. }
  233. },
  234. 'common.service.passive': {
  235. 'real': '/clusters/{clusterName}/services/{serviceName}',
  236. 'mock': '',
  237. 'format': function (data) {
  238. return {
  239. type: 'PUT',
  240. data: JSON.stringify({
  241. RequestInfo: {
  242. "context": data.requestInfo
  243. },
  244. Body: {
  245. ServiceInfo: {
  246. maintenance_state: data.passive_state
  247. }
  248. }
  249. })
  250. };
  251. }
  252. },
  253. 'common.host.host_component.passive': {
  254. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  255. 'mock': '',
  256. 'type': 'PUT',
  257. 'format': function (data) {
  258. return {
  259. data: JSON.stringify({
  260. RequestInfo: {
  261. "context": data.context
  262. },
  263. Body: {
  264. HostRoles: {
  265. maintenance_state: data.passive_state
  266. }
  267. }
  268. })
  269. };
  270. }
  271. },
  272. 'common.host.with_host_component': {
  273. 'real': '/clusters/{clusterName}/hosts?host_components/HostRoles/component_name={componentName}&minimal_response=true',
  274. 'mock': ''
  275. },
  276. 'common.delete.host': {
  277. 'real': '/clusters/{clusterName}/hosts/{hostName}',
  278. 'type': 'DELETE'
  279. },
  280. 'common.delete.host_component': {
  281. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  282. 'type': 'DELETE'
  283. },
  284. 'common.delete.user': {
  285. 'real': '/users/{user}',
  286. 'type': 'DELETE'
  287. },
  288. 'common.delete.config_group': {
  289. 'real': '/clusters/{clusterName}/config_groups/{id}',
  290. 'type': 'DELETE'
  291. },
  292. 'common.delete.cluster': {
  293. 'real': '/clusters/{name}',
  294. 'type': 'DELETE'
  295. },
  296. 'common.delete.service': {
  297. 'real': '/clusters/{clusterName}/services/{serviceName}',
  298. 'mock': '/data/services/ambari.json',
  299. 'type': 'DELETE'
  300. },
  301. 'common.delete.request_schedule': {
  302. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  303. 'type': 'DELETE'
  304. },
  305. 'alerts.load_alert_groups': {
  306. 'real': '/clusters/{clusterName}/alert_groups?fields=*',
  307. 'mock': 'data/alerts/alertGroups.json'
  308. },
  309. 'alerts.load_an_alert_group': {
  310. 'real': '/clusters/{clusterName}/alert_groups/{group_id}',
  311. 'mock': 'data/alerts/alertGroup.json'
  312. },
  313. 'alert_groups.create': {
  314. 'real': '/clusters/{clusterName}/alert_groups',
  315. 'mock': '',
  316. 'format': function (data) {
  317. return {
  318. type: 'POST',
  319. data: JSON.stringify({
  320. "AlertGroup": {
  321. "name": data.name,
  322. "definitions": data.definitions,
  323. "targets": data.targets
  324. }
  325. })
  326. };
  327. }
  328. },
  329. 'alert_groups.update': {
  330. 'real': '/clusters/{clusterName}/alert_groups/{group_id}',
  331. 'mock': '',
  332. 'format': function (data) {
  333. return {
  334. type: 'PUT',
  335. data: JSON.stringify({
  336. "AlertGroup": {
  337. "name": data.name,
  338. "definitions": data.definitions,
  339. "targets": data.targets
  340. }
  341. })
  342. };
  343. }
  344. },
  345. 'alert_groups.delete': {
  346. 'real': '/clusters/{clusterName}/alert_groups/{group_id}',
  347. 'mock': '',
  348. 'format': function (data) {
  349. return {
  350. type: 'DELETE'
  351. };
  352. }
  353. },
  354. 'alerts.load_all_alert_definitions': {
  355. 'real': '/clusters/{clusterName}/alert_definitions?fields=*',
  356. 'mock': 'data/alerts/alertDefinitions.json'
  357. },
  358. 'alerts.notifications': {
  359. 'real': '/alert_targets?fields=*',
  360. 'mock': '/data/alerts/alertNotifications.json'
  361. },
  362. 'alerts.instances': {
  363. 'real': '/clusters/{clusterName}/alerts?fields=*',
  364. 'mock': '/data/alerts/alert_instances.json'
  365. },
  366. 'alerts.instances.unhealthy': {
  367. 'real': '/clusters/{clusterName}/alerts?fields=*&Alert/state.in(CRITICAL,WARNING)&{paginationInfo}',
  368. 'mock': '/data/alerts/alert_instances.json'
  369. },
  370. 'alerts.instances.by_definition': {
  371. 'real': '/clusters/{clusterName}/alerts?fields=*&Alert/definition_id={definitionId}',
  372. 'mock': '/data/alerts/alert_instances.json'
  373. },
  374. 'alerts.instances.by_host': {
  375. 'real': '/clusters/{clusterName}/alerts?fields=*&Alert/host_name={hostName}',
  376. 'mock': '/data/alerts/alert_instances.json'
  377. },
  378. 'alerts.update_alert_definition': {
  379. 'real': '/clusters/{clusterName}/alert_definitions/{id}',
  380. 'mock': '',
  381. 'format': function (data) {
  382. return {
  383. type: 'PUT',
  384. data: JSON.stringify(data.data)
  385. }
  386. }
  387. },
  388. 'alerts.create_alert_definition': {
  389. 'real': '/clusters/{clusterName}/alert_definitions/',
  390. 'mock': '',
  391. 'format': function (data) {
  392. return {
  393. type: 'POST',
  394. data: JSON.stringify(data.data)
  395. }
  396. }
  397. },
  398. 'alerts.delete_alert_definition': {
  399. 'real': '/clusters/{clusterName}/alert_definitions/{id}',
  400. 'mock': '',
  401. 'type': 'DELETE'
  402. },
  403. 'alerts.create_alert_notification': {
  404. 'real': '/alert_targets?{urlParams}',
  405. 'mock': '',
  406. 'format': function (data) {
  407. return {
  408. type: 'POST',
  409. data: JSON.stringify(data.data)
  410. }
  411. }
  412. },
  413. 'alerts.update_alert_notification': {
  414. 'real': '/alert_targets/{id}',
  415. 'mock': '',
  416. 'format': function (data) {
  417. return {
  418. type: 'PUT',
  419. data: JSON.stringify(data.data)
  420. }
  421. }
  422. },
  423. 'alerts.delete_alert_notification': {
  424. 'real': '/alert_targets/{id}',
  425. 'mock': '',
  426. 'type': 'DELETE'
  427. },
  428. 'alerts.get_instances_history': {
  429. 'real': '/clusters/{clusterName}/alert_history?(AlertHistory/definition_name={definitionName})&(AlertHistory/timestamp>={timestamp})',
  430. 'mock': '/data/alerts/alert_instances_history.json'
  431. },
  432. 'background_operations.get_most_recent': {
  433. 'real': '/clusters/{clusterName}/requests?to=end&page_size={operationsCount}&fields=Requests',
  434. 'mock': '/data/background_operations/list_on_start.json',
  435. 'testInProduction': true
  436. },
  437. 'background_operations.get_by_request': {
  438. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=*,tasks/Tasks/request_id,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',
  439. 'mock': '/data/background_operations/task_by_request{requestId}.json',
  440. 'testInProduction': true
  441. },
  442. 'background_operations.get_by_task': {
  443. 'real': '/clusters/{clusterName}/requests/{requestId}/tasks/{taskId}',
  444. 'mock': '/data/background_operations/list_on_start.json',
  445. 'testInProduction': true
  446. },
  447. 'background_operations.abort_request': {
  448. 'real': '/clusters/{clusterName}/requests/{requestId}',
  449. 'mock': '',
  450. 'format': function () {
  451. return {
  452. type: 'PUT',
  453. data: JSON.stringify({
  454. "Requests": {
  455. "request_status": "ABORTED",
  456. "abort_reason": Em.I18n.t('hostPopup.bgop.abortRequest.reason')
  457. }
  458. })
  459. };
  460. }
  461. },
  462. 'service.item.smoke': {
  463. 'real': '/clusters/{clusterName}/requests',
  464. 'mock': '/data/wizard/deploy/poll_1.json',
  465. 'format': function (data) {
  466. var requestData = {
  467. "RequestInfo": {
  468. "context": data.displayName + " Service Check",
  469. "command": data.actionName
  470. },
  471. "Requests/resource_filters": [{"service_name": data.serviceName}]
  472. };
  473. if (data.operationLevel) {
  474. requestData.RequestInfo.operation_level = data.operationLevel;
  475. }
  476. return {
  477. 'type': 'POST',
  478. data: JSON.stringify(requestData)
  479. };
  480. }
  481. },
  482. 'service.item.rebalanceHdfsNodes': {
  483. 'real': '/clusters/{clusterName}/requests',
  484. 'mock': '',
  485. 'format': function (data) {
  486. return {
  487. type: 'POST',
  488. data: JSON.stringify({
  489. RequestInfo: {
  490. 'context': Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'),
  491. 'command': 'REBALANCEHDFS',
  492. 'namenode': JSON.stringify({threshold: data.threshold})
  493. },
  494. "Requests/resource_filters": [{
  495. 'service_name': 'HDFS',
  496. 'component_name': 'NAMENODE',
  497. 'hosts': data.hosts
  498. }]
  499. })
  500. }
  501. }
  502. },
  503. 'cancel.background.operation': {
  504. 'real': '/clusters/{clusterName}/requests/{requestId}',
  505. 'mock': '',
  506. 'format': function (data) {
  507. return {
  508. type: 'PUT',
  509. data: JSON.stringify({
  510. RequestInfo: {
  511. 'context': 'Cancel operation',
  512. "parameters": {
  513. "cancel_policy": "SIGKILL"
  514. }
  515. },
  516. "Requests/request_status": 'ABORTED',
  517. "Requests/abort_reason": "Cancel background operation"
  518. })
  519. }
  520. }
  521. },
  522. 'service.item.refreshQueueYarnRequest': {
  523. 'real': '/clusters/{clusterName}/requests',
  524. 'mock': '',
  525. 'format': function (data) {
  526. return {
  527. type: 'POST',
  528. data: JSON.stringify({
  529. RequestInfo: {
  530. 'context': data.context,
  531. 'command': data.command,
  532. 'parameters/forceRefreshConfigTags': data.forceRefreshConfigTags
  533. },
  534. "Requests/resource_filters": [{
  535. "service_name": data.serviceName,
  536. "component_name": data.componentName,
  537. 'hosts': data.hosts
  538. }]
  539. })
  540. }
  541. }
  542. },
  543. 'service.item.startStopLdapKnox': {
  544. 'real': '/clusters/{clusterName}/requests',
  545. 'mock': '',
  546. 'format': function (data) {
  547. return {
  548. type: 'POST',
  549. data: JSON.stringify({
  550. RequestInfo: {
  551. 'context': data.context,
  552. 'command': data.command
  553. },
  554. "Requests/resource_filters": [{
  555. "service_name": data.serviceName,
  556. "component_name": data.componentName,
  557. 'hosts': data.host
  558. }]
  559. })
  560. }
  561. }
  562. },
  563. 'service.item.executeCustomCommand': {
  564. 'real': '/clusters/{clusterName}/requests',
  565. 'mock': '',
  566. 'format': function (data) {
  567. return {
  568. type: 'POST',
  569. data: JSON.stringify({
  570. RequestInfo: {
  571. 'context': data.context,
  572. 'command': data.command
  573. },
  574. "Requests/resource_filters": [{
  575. "service_name": data.serviceName,
  576. "component_name": data.componentName,
  577. 'hosts': data.hosts
  578. }]
  579. })
  580. }
  581. }
  582. },
  583. /*************************CONFIG THEME****************************************/
  584. 'configs.theme': {
  585. 'real': '{stackVersionUrl}/services/{serviceName}/artifacts/theme',
  586. 'mock': '/data/configurations/theme.json'
  587. },
  588. /*************************CONFIG GROUPS***************************************/
  589. 'configs.config_groups.load.all': {
  590. 'real': '/clusters/{clusterName}/config_groups?fields=*',
  591. 'mock': '/data/configurations/config_groups.json'
  592. },
  593. 'configs.config_groups.load.services': {
  594. 'real': '/clusters/{clusterName}/config_groups?ConfigGroup/tag.in({serviceList})&fields=*',
  595. 'mock': '/data/configurations/config_groups.json'
  596. },
  597. /*************************STACK CONFIGS**************************************/
  598. 'configs.stack_configs.load.all': {
  599. 'real': '{stackVersionUrl}/services?fields=configurations/*,StackServices/config_types/*',
  600. 'mock': '/data/stacks/HDP-2.2/configurations.json'
  601. },
  602. 'configs.stack_configs.load.services': {
  603. 'real': '{stackVersionUrl}/services?StackServices/service_name.in({serviceList})&fields=configurations/*,StackServices/config_types/*',
  604. 'mock': '/data/stacks/HDP-2.2/configurations.json'
  605. },
  606. 'configs.stack_configs.load.service': {
  607. 'real': '{stackVersionUrl}/services/{serviceName}?fields=configurations/*,StackServices/config_types/*',
  608. 'mock': '/data/stacks/HDP-2.2/configurations.json'
  609. },
  610. /*************************CONFIG VERSIONS*************************************/
  611. 'configs.config_versions.load.all.min': {
  612. 'real': '/clusters/{clusterName}/configurations/service_config_versions?fields=service_config_version,user,hosts,group_id,group_name,is_current,createtime,service_name,service_config_version_note&minimal_response=true',
  613. 'mock': '/data/configurations/config_versions.json'
  614. },
  615. 'configs.config_versions.load.service.min': {
  616. 'real': '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&fields=service_config_version,user,hosts,group_id,group_name,is_current,createtime,service_name,service_config_version_note&minimal_response=true',
  617. 'mock': '/data/configurations/config_versions.json'
  618. },
  619. 'configs.config_versions.load': {
  620. 'real': '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&service_config_version={configVersion}&fields=*',
  621. 'mock': '/data/configurations/config_versions.json'
  622. },
  623. 'configs.config_versions.load.group': {
  624. 'real': '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&group_id={configGroupId}&fields=*',
  625. 'mock': '/data/configurations/config_versions.json'
  626. },
  627. 'configs.config_versions.load.current_versions': {
  628. 'real': '/clusters/{clusterName}/configurations/service_config_versions?service_name.in({serviceNames})&group_id=-1&is_current=true&fields=*',
  629. 'mock': '/data/configurations/config_versions.json'
  630. },
  631. 'service.load_config_groups': {
  632. 'real': '/clusters/{clusterName}/config_groups?ConfigGroup/tag={serviceName}&fields=*',
  633. 'mock': '/data/configurations/config_group.json'
  634. },
  635. 'reassign.load_configs': {
  636. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  637. 'mock': ''
  638. },
  639. 'reassign.save_configs': {
  640. 'real': '/clusters/{clusterName}',
  641. 'mock': '',
  642. 'type': 'PUT',
  643. 'format': function (data) {
  644. return {
  645. data: JSON.stringify({
  646. Clusters: {
  647. desired_config: {
  648. "type": data.siteName,
  649. "tag": 'version' + (new Date).getTime(),
  650. "properties": data.properties,
  651. "service_config_version_note": data.service_config_version_note
  652. }
  653. }
  654. })
  655. }
  656. }
  657. },
  658. 'config.cluster': {
  659. 'real': '{stackVersionUrl}/configurations?fields=*',
  660. 'mock': ''
  661. },
  662. 'config.advanced': {
  663. 'real': '{stackVersionUrl}/services/{serviceName}/configurations?fields=*',
  664. 'mock': '/data/wizard/stack/hdp/version{stackVersion}/{serviceName}.json'
  665. },
  666. 'config.advanced.partial': {
  667. 'real': '{stackVersionUrl}/services/?StackServices/service_name.in({serviceList})&fields=configurations/*{queryFilter}',
  668. 'mock': ''
  669. },
  670. 'config.config_types': {
  671. 'real': '{stackVersionUrl}/services/{serviceName}?fields=StackServices/config_types',
  672. 'mock': ''
  673. },
  674. 'config.tags': {
  675. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs',
  676. 'mock': '/data/clusters/cluster.json'
  677. },
  678. 'config.tags_and_groups': {
  679. 'real': '/clusters/{clusterName}?fields=Clusters/desired_configs,config_groups/*{urlParams}',
  680. 'mock': '/data/clusters/tags_and_groups.json'
  681. },
  682. 'config.ambari.database.info': {
  683. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=hostComponents/RootServiceHostComponents/properties/server.jdbc.database_name,hostComponents/RootServiceHostComponents/properties/server.jdbc.url',
  684. 'mock': ''
  685. },
  686. 'config_groups.all_fields': {
  687. 'real': '/clusters/{clusterName}/config_groups?fields=*',
  688. 'mock': ''
  689. },
  690. 'config_groups.get_config_group_by_id': {
  691. 'real': '/clusters/{clusterName}/config_groups/{id}',
  692. 'mock': ''
  693. },
  694. 'config_groups.update_config_group': {
  695. 'real': '/clusters/{clusterName}/config_groups/{id}',
  696. 'mock': '',
  697. 'type': 'PUT',
  698. 'format': function (data) {
  699. return {
  700. data: JSON.stringify(
  701. [
  702. data.configGroup
  703. ]
  704. )
  705. }
  706. }
  707. },
  708. 'config.on_site': {
  709. 'real': '/clusters/{clusterName}/configurations?{params}',
  710. 'mock': '/data/configurations/cluster_level_configs.json?{params}'
  711. },
  712. 'config.host_overrides': {
  713. 'real': '/clusters/{clusterName}/configurations?{params}',
  714. 'mock': '/data/configurations/host_level_overrides_configs.json?{params}'
  715. },
  716. 'config.cluster_env_site': {
  717. 'real': '/clusters/{clusterName}/configurations?type=cluster-env',
  718. 'mock': '/data/configuration/cluster_env_site.json'
  719. },
  720. 'host.host_component.add_new_component': {
  721. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  722. 'mock': '/data/wizard/deploy/poll_1.json',
  723. 'format': function (data) {
  724. return {
  725. type: 'POST',
  726. data: data.data
  727. }
  728. }
  729. },
  730. 'host.host_component.slave_desired_admin_state': {
  731. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}/?fields=HostRoles/desired_admin_state',
  732. 'mock': '/data/hosts/HDP2/decommission_state.json'
  733. },
  734. 'host.host_component.decommission_status': {
  735. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}/?fields=ServiceComponentInfo,host_components/HostRoles/state',
  736. 'mock': ''
  737. },
  738. 'host_components.hbase_regionserver.active': {
  739. 'real': '/clusters/{clusterName}/host_components?HostRoles/component_name=HBASE_REGIONSERVER&HostRoles/maintenance_state=OFF&HostRoles/desired_admin_state=INSERVICE&HostRoles/host_name.in({hostNames})',
  740. 'mock': ''
  741. },
  742. 'host.host_component.decommission_status_datanode': {
  743. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}?fields=metrics/dfs/namenode',
  744. 'mock': '/data/hosts/HDP2/decommission_state.json'
  745. },
  746. 'host.region_servers.in_inservice': {
  747. 'real': '/clusters/{clusterName}/host_components?HostRoles/component_name=HBASE_REGIONSERVER&HostRoles/desired_admin_state=INSERVICE&fields=HostRoles/host_name&minimal_response=true',
  748. 'mock': ''
  749. },
  750. 'host.host_component.decommission_slave': {
  751. 'real': '/clusters/{clusterName}/requests',
  752. 'mock': '',
  753. 'format': function (data) {
  754. return {
  755. type: 'POST',
  756. data: JSON.stringify({
  757. RequestInfo: {
  758. 'context': data.context,
  759. 'command': data.command,
  760. 'parameters': {
  761. 'slave_type': data.slaveType,
  762. 'excluded_hosts': data.hostName
  763. },
  764. 'operation_level': {
  765. level: "HOST_COMPONENT",
  766. cluster_name: data.clusterName,
  767. host_name: data.hostName,
  768. service_name: data.serviceName
  769. }
  770. },
  771. "Requests/resource_filters": [{"service_name": data.serviceName, "component_name": data.componentName}]
  772. })
  773. }
  774. }
  775. },
  776. 'host.host_component.recommission_and_restart': {
  777. 'real': '/clusters/{clusterName}/request_schedules',
  778. 'mock': '',
  779. 'format': function (data) {
  780. return {
  781. type: 'POST',
  782. data: JSON.stringify([{
  783. "RequestSchedule": {
  784. "batch": [{
  785. "requests": data.batches
  786. }, {
  787. "batch_settings": {
  788. "batch_separation_in_seconds": data.intervalTimeSeconds,
  789. "task_failure_tolerance": data.tolerateSize
  790. }
  791. }]
  792. }
  793. }])
  794. }
  795. }
  796. },
  797. 'host.host_component.refresh_configs': {
  798. 'real': '/clusters/{clusterName}/requests',
  799. 'mock': '',
  800. 'format': function (data) {
  801. return {
  802. type: 'POST',
  803. data: JSON.stringify({
  804. "RequestInfo": {
  805. "command": "CONFIGURE",
  806. "context": data.context
  807. },
  808. "Requests/resource_filters": data.resource_filters
  809. })
  810. }
  811. }
  812. },
  813. 'hosts.metrics': {
  814. 'real': '/clusters/{clusterName}/hosts?fields={metricName}',
  815. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  816. },
  817. 'hosts.metrics.host_component': {
  818. 'real': '/clusters/{clusterName}/services/{serviceName}/components/{componentName}?fields=host_components/{metricName}',
  819. 'mock': '/data/cluster_metrics/cpu_1hr.json'
  820. },
  821. 'service.metrics.flume.channel_fill_percent': {
  822. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/ChannelFillPercentage[{fromSeconds},{toSeconds},{stepSeconds}]',
  823. 'mock': '/data/services/metrics/flume/channelFillPct.json',
  824. 'testInProduction': true
  825. },
  826. 'service.metrics.flume.channel_size': {
  827. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/CHANNEL/ChannelSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  828. 'mock': '/data/services/metrics/flume/channelSize.json',
  829. 'testInProduction': true
  830. },
  831. 'service.metrics.flume.sink_drain_success': {
  832. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/EventDrainSuccessCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  833. 'mock': '/data/services/metrics/flume/sinkDrainSuccessCount.json',
  834. 'testInProduction': true
  835. },
  836. 'service.metrics.flume.sink_connection_failed': {
  837. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SINK/ConnectionFailedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  838. 'mock': '/data/services/metrics/flume/sinkConnectionFailedCount.json',
  839. 'testInProduction': true
  840. },
  841. 'service.metrics.flume.source_accepted': {
  842. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/flume/flume/SOURCE/EventAcceptedCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  843. 'mock': '/data/services/metrics/flume/sourceEventAccepted.json',
  844. 'testInProduction': true
  845. },
  846. 'service.metrics.flume.channel_size_for_all': {
  847. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/ChannelSize/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
  848. },
  849. 'service.metrics.flume.gc': {
  850. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  851. 'mock': '/data/services/metrics/flume/jvmGcTime.json',
  852. 'testInProduction': true
  853. },
  854. 'service.metrics.flume.jvm_heap_used': {
  855. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/memHeapUsedM[{fromSeconds},{toSeconds},{stepSeconds}]',
  856. 'mock': '/data/services/metrics/flume/jvmMemHeapUsedM.json',
  857. 'testInProduction': true
  858. },
  859. 'service.metrics.flume.jvm_threads_runnable': {
  860. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/jvm/threadsRunnable[{fromSeconds},{toSeconds},{stepSeconds}]',
  861. 'mock': '/data/services/metrics/flume/jvmThreadsRunnable.json',
  862. 'testInProduction': true
  863. },
  864. 'service.metrics.flume.cpu_user': {
  865. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=host_components/metrics/cpu/cpu_user[{fromSeconds},{toSeconds},{stepSeconds}]',
  866. 'mock': '',
  867. 'testInProduction': true
  868. },
  869. 'service.metrics.flume.incoming_event_put_successCount': {
  870. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventPutSuccessCount/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
  871. },
  872. 'service.metrics.flume.outgoing_event_take_success_count': {
  873. 'real': '/clusters/{clusterName}/services/FLUME/components/FLUME_HANDLER?fields=metrics/flume/flume/CHANNEL/EventTakeSuccessCount/rate[{fromSeconds},{toSeconds},{stepSeconds}]'
  874. },
  875. 'service.metrics.hbase.cluster_requests': {
  876. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/cluster_requests[{fromSeconds},{toSeconds},{stepSeconds}]',
  877. 'mock': '/data/services/metrics/hbase/cluster_requests.json',
  878. 'testInProduction': true
  879. },
  880. 'service.metrics.hbase.hlog_split_size': {
  881. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitSize_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  882. 'mock': '/data/services/metrics/hbase/hlog_split_size.json',
  883. 'testInProduction': true
  884. },
  885. 'service.metrics.hbase.hlog_split_time': {
  886. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_MASTER?fields=metrics/hbase/master/splitTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  887. 'mock': '/data/services/metrics/hbase/hlog_split_time.json',
  888. 'testInProduction': true
  889. },
  890. 'service.metrics.hbase.regionserver_queuesize': {
  891. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/flushQueueSize[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/compactionQueueSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  892. 'mock': '/data/services/metrics/hbase/regionserver_queuesize.json',
  893. 'testInProduction': true
  894. },
  895. 'service.metrics.hbase.regionserver_regions': {
  896. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/regions[{fromSeconds},{toSeconds},{stepSeconds}]',
  897. 'mock': '/data/services/metrics/hbase/regionserver_regions.json',
  898. 'testInProduction': true
  899. },
  900. 'service.metrics.hbase.regionserver_rw_requests': {
  901. 'real': '/clusters/{clusterName}/services/HBASE/components/HBASE_REGIONSERVER?fields=metrics/hbase/regionserver/readRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}],metrics/hbase/regionserver/writeRequestsCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  902. 'mock': '/data/services/metrics/hbase/regionserver_rw_requests.json',
  903. 'testInProduction': true
  904. },
  905. 'service.metrics.ambari_metrics.master.average_load': {
  906. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/master/AverageLoad[{fromSeconds},{toSeconds},{stepSeconds}]',
  907. 'mock': '/data/services/metrics/ambari_metrics/master_average_load.json',
  908. 'testInProduction': true
  909. },
  910. 'service.metrics.ambari_metrics.region_server.store_files': {
  911. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/regionserver/storefiles[{fromSeconds},{toSeconds},{stepSeconds}]',
  912. 'mock': '/data/services/metrics/ambari_metrics/regionserver_store_files.json',
  913. 'testInProduction': true
  914. },
  915. 'service.metrics.ambari_metrics.region_server.regions': {
  916. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/regionserver/regions[{fromSeconds},{toSeconds},{stepSeconds}]',
  917. 'mock': '/data/services/metrics/ambari_metrics/regionserver_regions.json',
  918. 'testInProduction': true
  919. },
  920. 'service.metrics.ambari_metrics.region_server.request': {
  921. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/regionserver/requests[{fromSeconds},{toSeconds},{stepSeconds}]',
  922. 'mock': '/data/services/metrics/ambari_metrics/regionserver_requests.json',
  923. 'testInProduction': true
  924. },
  925. 'service.metrics.ambari_metrics.region_server.block_cache_hit_percent': {
  926. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/regionserver/blockCacheHitPercent[{fromSeconds},{toSeconds},{stepSeconds}]',
  927. 'mock': '/data/services/metrics/ambari_metrics/regionserver_blockcache_hitpercent.json',
  928. 'testInProduction': true
  929. },
  930. 'service.metrics.ambari_metrics.region_server.compaction_queue_size': {
  931. 'real': '/clusters/{clusterName}/services/AMBARI_METRICS/components/METRICS_COLLECTOR?fields=metrics/hbase/regionserver/compactionQueueSize[{fromSeconds},{toSeconds},{stepSeconds}]',
  932. 'mock': '/data/services/metrics/ambari_metrics/regionserver_compaction_queue_size.json',
  933. 'testInProduction': true
  934. },
  935. 'service.metrics.hdfs.block_status': {
  936. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/PendingReplicationBlocks[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/UnderReplicatedBlocks[{fromSeconds},{toSeconds},{stepSeconds}]',
  937. 'mock': '/data/services/metrics/hdfs/block_status.json',
  938. 'testInProduction': true
  939. },
  940. 'service.metrics.hdfs.file_operations': {
  941. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/namenode/FileInfoOps[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/namenode/CreateFileOps[{fromSeconds},{toSeconds},{stepSeconds}]',
  942. 'mock': '/data/services/metrics/hdfs/file_operations.json',
  943. 'testInProduction': true
  944. },
  945. 'service.metrics.hdfs.gc': {
  946. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  947. 'mock': '/data/services/metrics/hdfs/gc.json',
  948. 'testInProduction': true
  949. },
  950. 'service.metrics.hdfs.io': {
  951. 'real': '/clusters/{clusterName}/services/HDFS/components/DATANODE?fields=metrics/dfs/datanode/bytes_written[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/datanode/bytes_read[{fromSeconds},{toSeconds},{stepSeconds}]',
  952. 'mock': '/data/services/metrics/hdfs/io.json',
  953. 'testInProduction': true
  954. },
  955. 'service.metrics.hdfs.jvm_heap': {
  956. '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}]',
  957. 'mock': '/data/services/metrics/hdfs/jvm_heap.json',
  958. 'testInProduction': true
  959. },
  960. 'service.metrics.hdfs.jvm_threads': {
  961. '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}]',
  962. 'mock': '/data/services/metrics/hdfs/jvm_threads.json',
  963. 'testInProduction': true
  964. },
  965. 'service.metrics.hdfs.rpc': {
  966. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  967. 'mock': '/data/services/metrics/hdfs/rpc.json',
  968. 'testInProduction': true
  969. },
  970. 'service.metrics.hdfs.space_utilization': {
  971. 'real': '/clusters/{clusterName}/hosts/{nameNodeName}/host_components/NAMENODE?fields=metrics/dfs/FSNamesystem/CapacityRemaining[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityUsed[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityTotal[{fromSeconds},{toSeconds},{stepSeconds}],metrics/dfs/FSNamesystem/CapacityNonDFSUsed[{fromSeconds},{toSeconds},{stepSeconds}]',
  972. 'mock': '/data/services/metrics/hdfs/space_utilization.json',
  973. 'testInProduction': true
  974. },
  975. 'service.metrics.yarn.gc': {
  976. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/jvm/gcTimeMillis[{fromSeconds},{toSeconds},{stepSeconds}]',
  977. 'mock': '/data/services/metrics/yarn/gc.json',
  978. 'testInProduction': true
  979. },
  980. 'service.metrics.yarn.jobs_threads': {
  981. '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}]',
  982. 'mock': '/data/services/metrics/yarn/jvm_threads.json',
  983. 'testInProduction': true
  984. },
  985. 'service.metrics.yarn.rpc': {
  986. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=metrics/rpc/RpcQueueTime_avg_time[{fromSeconds},{toSeconds},{stepSeconds}]',
  987. 'mock': '/data/services/metrics/yarn/rpc.json',
  988. 'testInProduction': true
  989. },
  990. 'service.metrics.yarn.jobs_heap': {
  991. '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}]',
  992. 'mock': '/data/services/metrics/yarn/jvm_heap.json',
  993. 'testInProduction': true
  994. },
  995. 'service.metrics.yarn.queue.allocated': {
  996. '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}]',
  997. 'mock': '',
  998. 'testInProduction': true
  999. },
  1000. 'service.metrics.yarn.queue.allocated.container': {
  1001. '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}]',
  1002. 'mock': '',
  1003. 'testInProduction': true
  1004. },
  1005. 'service.metrics.yarn.node.manager.statuses': {
  1006. '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}]',
  1007. 'mock': '',
  1008. 'testInProduction': true
  1009. },
  1010. 'service.metrics.yarn.queue.memory.resource': {
  1011. 'real': '/clusters/{clusterName}/hosts/{resourceManager}/host_components/RESOURCEMANAGER?fields=',
  1012. 'mock': '',
  1013. 'format': function (data, opt) {
  1014. var field1 = 'metrics/yarn/Queue/{queueName}/AllocatedMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  1015. var field2 = 'metrics/yarn/Queue/{queueName}/AvailableMB[{fromSeconds},{toSeconds},{stepSeconds}]';
  1016. if (opt.url != null && data.queueNames != null && data.queueNames.length > 0) {
  1017. data.queueNames.forEach(function (q) {
  1018. data.queueName = q;
  1019. opt.url += (formatUrl(field1, data) + ",");
  1020. opt.url += (formatUrl(field2, data) + ",");
  1021. });
  1022. } else {
  1023. opt.url += (formatUrl(field1, data) + ",");
  1024. opt.url += (formatUrl(field2, data) + ",");
  1025. }
  1026. },
  1027. 'testInProduction': true
  1028. },
  1029. 'service.metrics.yarn.queue.apps.states.current': {
  1030. '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}]',
  1031. 'mock': '',
  1032. 'testInProduction': true
  1033. },
  1034. 'service.metrics.yarn.queue.apps.states.finished': {
  1035. '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}]',
  1036. 'mock': '',
  1037. 'testInProduction': true
  1038. },
  1039. 'service.metrics.kafka.broker.topic': {
  1040. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesInPerSec/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}],metrics/kafka/server/BrokerTopicMetrics/AllTopicsBytesOutPerSec/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}],metrics/kafka/server/BrokerTopicMetrics/AllTopicsMessagesInPerSec/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}]',
  1041. 'mock': ''
  1042. },
  1043. 'service.metrics.kafka.controller.KafkaController': {
  1044. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/controller/KafkaController/ActiveControllerCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  1045. 'mock': ''
  1046. },
  1047. 'service.metrics.kafka.controller.ControllerStats': {
  1048. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/controller/ControllerStats/LeaderElectionRateAndTimeMs/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}],metrics/kafka/controller/ControllerStats/UncleanLeaderElectionsPerSec/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}]',
  1049. 'mock': ''
  1050. },
  1051. 'service.metrics.kafka.log.LogFlushStats': {
  1052. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/log/LogFlushStats/LogFlushRateAndTimeMs/1MinuteRate[{fromSeconds},{toSeconds},{stepSeconds}]',
  1053. 'mock': ''
  1054. },
  1055. 'service.metrics.kafka.server.ReplicaManager': {
  1056. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/server/ReplicaManager/PartitionCount[{fromSeconds},{toSeconds},{stepSeconds}],metrics/kafka/server/ReplicaManager/UnderReplicatedPartitions[{fromSeconds},{toSeconds},{stepSeconds}],metrics/kafka/server/BrokerTopicMetrics/ReplicaManager/LeaderCount[{fromSeconds},{toSeconds},{stepSeconds}]',
  1057. 'mock': ''
  1058. },
  1059. 'service.metrics.kafka.server.ReplicaFetcherManager': {
  1060. 'real': '/clusters/{clusterName}/services/KAFKA/components/KAFKA_BROKER?fields=metrics/kafka/server/ReplicaFetcherManager/Replica-MaxLag[{fromSeconds},{toSeconds},{stepSeconds}]',
  1061. 'mock': ''
  1062. },
  1063. 'service.metrics.storm.nimbus': {
  1064. 'real': '/clusters/{clusterName}/services/STORM/components/NIMBUS?fields={metricsTemplate}',
  1065. 'mock': ''
  1066. },
  1067. 'dashboard.cluster_metrics.cpu': {
  1068. 'real': '/clusters/{clusterName}/?fields=metrics/cpu[{fromSeconds},{toSeconds},{stepSeconds}]',
  1069. 'mock': '/data/cluster_metrics/cpu_1hr.json',
  1070. 'testInProduction': true
  1071. },
  1072. 'dashboard.cluster_metrics.load': {
  1073. 'real': '/clusters/{clusterName}/?fields=metrics/load[{fromSeconds},{toSeconds},{stepSeconds}]',
  1074. 'mock': '/data/cluster_metrics/load_1hr.json',
  1075. 'testInProduction': true
  1076. },
  1077. 'dashboard.cluster_metrics.memory': {
  1078. 'real': '/clusters/{clusterName}/?fields=metrics/memory[{fromSeconds},{toSeconds},{stepSeconds}]',
  1079. 'mock': '/data/cluster_metrics/memory_1hr.json',
  1080. 'testInProduction': true
  1081. },
  1082. 'dashboard.cluster_metrics.network': {
  1083. 'real': '/clusters/{clusterName}/?fields=metrics/network[{fromSeconds},{toSeconds},{stepSeconds}]',
  1084. 'mock': '/data/cluster_metrics/network_1hr.json',
  1085. 'testInProduction': true
  1086. },
  1087. 'host.metrics.cpu': {
  1088. '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}]',
  1089. 'mock': '/data/hosts/metrics/cpu.json',
  1090. 'testInProduction': true
  1091. },
  1092. 'host.metrics.disk': {
  1093. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/disk/disk_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/disk/disk_free[{fromSeconds},{toSeconds},{stepSeconds}]',
  1094. 'mock': '/data/hosts/metrics/disk.json',
  1095. 'testInProduction': true
  1096. },
  1097. 'host.metrics.load': {
  1098. '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}]',
  1099. 'mock': '/data/hosts/metrics/load.json',
  1100. 'testInProduction': true
  1101. },
  1102. 'host.metrics.memory': {
  1103. '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}]',
  1104. 'mock': '/data/hosts/metrics/memory.json',
  1105. 'testInProduction': true
  1106. },
  1107. 'host.metrics.network': {
  1108. '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}]',
  1109. 'mock': '/data/hosts/metrics/network.json',
  1110. 'testInProduction': true
  1111. },
  1112. 'host.metrics.processes': {
  1113. 'real': '/clusters/{clusterName}/hosts/{hostName}?fields=metrics/process/proc_total[{fromSeconds},{toSeconds},{stepSeconds}],metrics/process/proc_run[{fromSeconds},{toSeconds},{stepSeconds}]',
  1114. 'mock': '/data/hosts/metrics/processes.json',
  1115. 'testInProduction': true
  1116. },
  1117. 'admin.security_status': {
  1118. 'real': '/clusters/{clusterName}?fields=Clusters/security_type',
  1119. 'mock': '',
  1120. 'format': function () {
  1121. return {
  1122. timeout: 10000
  1123. };
  1124. }
  1125. },
  1126. 'settings.get.user_pref': {
  1127. 'real': '/persist/{key}',
  1128. 'mock': '/data/user_settings/{key}.json'
  1129. },
  1130. 'settings.post.user_pref': {
  1131. 'real': '/persist',
  1132. 'mock': '',
  1133. 'type': 'POST',
  1134. 'format': function (data) {
  1135. return {
  1136. data: JSON.stringify(data.keyValuePair)
  1137. }
  1138. }
  1139. },
  1140. 'cluster.load_cluster_name': {
  1141. 'real': '/clusters',
  1142. 'mock': '/data/clusters/info.json'
  1143. },
  1144. 'cluster.update_upgrade_version': {
  1145. 'real': '/stacks/{stackName}/versions?fields=services/StackServices,Versions',
  1146. 'mock': '/data/wizard/stack/stacks.json',
  1147. 'format': function (data) {
  1148. return {
  1149. data: data.data
  1150. };
  1151. }
  1152. },
  1153. 'cluster.load_repositories': {
  1154. 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems?fields=repositories/*',
  1155. 'mock': '/data/stacks/HDP-2.1/operating_systems.json',
  1156. 'format': function (data) {
  1157. return {
  1158. data: data.data
  1159. };
  1160. }
  1161. },
  1162. 'cluster.load_detailed_repo_version': {
  1163. 'real': '/clusters/{clusterName}/stack_versions?ClusterStackVersions/state=CURRENT&fields=repository_versions/RepositoryVersions/repository_version&minimal_response=true',
  1164. 'mock': '/data/stack_versions/stack_version_all.json'
  1165. },
  1166. 'cluster.save_provisioning_state': {
  1167. 'real': '/clusters/{clusterName}',
  1168. 'type': 'PUT',
  1169. 'format': function (data) {
  1170. return {
  1171. data: JSON.stringify({
  1172. "Clusters": {
  1173. "provisioning_state": data.state
  1174. }
  1175. })
  1176. };
  1177. }
  1178. },
  1179. 'admin.high_availability.polling': {
  1180. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=tasks/*,Requests/*',
  1181. 'mock': '/data/background_operations/host_upgrade_tasks.json'
  1182. },
  1183. 'admin.high_availability.getNnCheckPointStatus': {
  1184. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/NAMENODE',
  1185. 'mock': ''
  1186. },
  1187. 'admin.high_availability.getJnCheckPointStatus': {
  1188. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/JOURNALNODE?fields=metrics',
  1189. 'mock': ''
  1190. },
  1191. 'admin.high_availability.getHostComponent': {
  1192. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/{componentName}',
  1193. 'mock': ''
  1194. },
  1195. 'admin.high_availability.create_component': {
  1196. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name={hostName}',
  1197. 'mock': '',
  1198. 'type': 'POST',
  1199. 'format': function (data) {
  1200. return {
  1201. data: JSON.stringify({
  1202. "host_components": [
  1203. {
  1204. "HostRoles": {
  1205. "component_name": data.componentName
  1206. }
  1207. }
  1208. ]
  1209. })
  1210. }
  1211. }
  1212. },
  1213. 'admin.high_availability.create_journalnode': {
  1214. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=HDFS',
  1215. 'mock': '',
  1216. 'type': 'POST',
  1217. 'format': function () {
  1218. return {
  1219. data: JSON.stringify({
  1220. "components": [
  1221. {
  1222. "ServiceComponentInfo": {
  1223. "component_name": "JOURNALNODE"
  1224. }
  1225. }
  1226. ]
  1227. })
  1228. }
  1229. }
  1230. },
  1231. 'common.create_component': {
  1232. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name={serviceName}',
  1233. 'mock': '',
  1234. 'type': 'POST',
  1235. 'format': function (data) {
  1236. return {
  1237. data: JSON.stringify({
  1238. "components": [
  1239. {
  1240. "ServiceComponentInfo": {
  1241. "component_name": data.componentName
  1242. }
  1243. }
  1244. ]
  1245. })
  1246. }
  1247. }
  1248. },
  1249. 'admin.high_availability.create_zkfc': {
  1250. 'real': '/clusters/{clusterName}/services?ServiceInfo/service_name=HDFS',
  1251. 'mock': '',
  1252. 'type': 'POST',
  1253. 'format': function () {
  1254. return {
  1255. data: JSON.stringify({
  1256. "components": [
  1257. {
  1258. "ServiceComponentInfo": {
  1259. "component_name": "ZKFC"
  1260. }
  1261. }
  1262. ]
  1263. })
  1264. }
  1265. }
  1266. },
  1267. 'admin.high_availability.load_configs': {
  1268. 'real': '/clusters/{clusterName}/configurations?(type=core-site&tag={coreSiteTag})|(type=hdfs-site&tag={hdfsSiteTag})',
  1269. 'mock': ''
  1270. },
  1271. 'admin.high_availability.save_configs': {
  1272. 'real': '/clusters/{clusterName}',
  1273. 'mock': '',
  1274. 'type': 'PUT',
  1275. 'format': function (data) {
  1276. return {
  1277. data: JSON.stringify({
  1278. Clusters: {
  1279. desired_config: {
  1280. "type": data.siteName,
  1281. "tag": 'version' + (new Date).getTime(),
  1282. "properties": data.properties
  1283. }
  1284. }
  1285. })
  1286. }
  1287. }
  1288. },
  1289. 'admin.high_availability.load_hbase_configs': {
  1290. 'real': '/clusters/{clusterName}/configurations?type=hbase-site&tag={hbaseSiteTag}',
  1291. 'mock': ''
  1292. },
  1293. 'admin.security.cluster_configs': {
  1294. 'real': '/clusters/{clusterName}',
  1295. 'mock': '',
  1296. 'format': function () {
  1297. return {
  1298. timeout: 10000
  1299. };
  1300. }
  1301. },
  1302. 'admin.get.all_configurations': {
  1303. 'real': '/clusters/{clusterName}/configurations?{urlParams}',
  1304. 'mock': '',
  1305. 'format': function () {
  1306. return {
  1307. timeout: 10000
  1308. };
  1309. }
  1310. },
  1311. 'admin.security.add.cluster_configs': {
  1312. 'real': '/clusters/{clusterName}' + '?fields=Clusters/desired_configs',
  1313. 'mock': '',
  1314. 'format': function () {
  1315. return {
  1316. timeout: 10000
  1317. };
  1318. }
  1319. },
  1320. 'kerberos.session.state': {
  1321. 'real': '/clusters/{clusterName}/services/KERBEROS?fields=Services/attributes/kdc_validation_result,Services/attributes/kdc_validation_failure_details',
  1322. 'mock': ''
  1323. },
  1324. 'admin.kerberize.cluster': {
  1325. 'type': 'PUT',
  1326. 'real': '/clusters/{clusterName}',
  1327. 'mock': '/data/wizard/kerberos/kerberize_cluster.json',
  1328. 'format' : function (data) {
  1329. return {
  1330. data: JSON.stringify(data.data)
  1331. }
  1332. }
  1333. },
  1334. 'admin.unkerberize.cluster': {
  1335. 'type': 'PUT',
  1336. 'real': '/clusters/{clusterName}',
  1337. 'format': function (data) {
  1338. return {
  1339. data: JSON.stringify({
  1340. Clusters: {
  1341. security_type: "NONE"
  1342. }
  1343. })
  1344. }
  1345. }
  1346. },
  1347. 'get.cluster.artifact': {
  1348. 'real': '/clusters/{clusterName}/artifacts/{artifactName}?fields=artifact_data',
  1349. 'mock': '/data/wizard/kerberos/stack_descriptors.json'
  1350. },
  1351. 'admin.kerberize.stack_descriptor': {
  1352. 'real': '/stacks/{stackName}/versions/{stackVersionNumber}/artifacts/kerberos_descriptor?fields=artifact_data',
  1353. 'mock': '/data/wizard/kerberos/stack_descriptors.json'
  1354. },
  1355. 'admin.kerberize.cluster_descriptor': {
  1356. 'real': '/clusters/{clusterName}/artifacts/kerberos_descriptor?fields=artifact_data',
  1357. 'mock': '/data/wizard/kerberos/stack_descriptors.json'
  1358. },
  1359. 'admin.kerberos.cluster.artifact.create': {
  1360. 'type': 'POST',
  1361. 'real': '/clusters/{clusterName}/artifacts/{artifactName}',
  1362. 'format' : function (data) {
  1363. return {
  1364. data: JSON.stringify(data.data)
  1365. }
  1366. }
  1367. },
  1368. 'admin.kerberos.cluster.artifact.update': {
  1369. 'type': 'PUT',
  1370. 'real': '/clusters/{clusterName}/artifacts/{artifactName}',
  1371. 'format' : function (data) {
  1372. return {
  1373. data: JSON.stringify(data.data)
  1374. }
  1375. }
  1376. },
  1377. 'admin.poll.kerberize.cluster.request': {
  1378. 'real': '/clusters/{clusterName}/requests/{requestId}?fields=stages/Stage/context,stages/Stage/status,stages/Stage/progress_percent,stages/tasks/*,Requests/*',
  1379. 'mock': '/data/wizard/kerberos/kerberize_cluster.json'
  1380. },
  1381. 'admin.stack_upgrade.run_upgrade': {
  1382. 'real': '/clusters/{clusterName}',
  1383. 'mock': '',
  1384. 'format': function (data) {
  1385. return {
  1386. type: 'PUT',
  1387. data: data.data
  1388. };
  1389. }
  1390. },
  1391. 'admin.user.create': {
  1392. 'real': '/users/{user}',
  1393. 'mock': '/data/users/users.json',
  1394. 'format': function (data) {
  1395. return {
  1396. type: 'POST',
  1397. data: JSON.stringify(data.data)
  1398. }
  1399. }
  1400. },
  1401. 'admin.user.edit': {
  1402. 'real': '/users/{user}',
  1403. 'mock': '/data/users/users.json',
  1404. 'format': function (data) {
  1405. return {
  1406. type: 'PUT',
  1407. data: data.data
  1408. }
  1409. }
  1410. },
  1411. 'admin.stack_upgrade.do_poll': {
  1412. 'real': '/clusters/{cluster}/requests/{requestId}?fields=tasks/*',
  1413. 'mock': '/data/wizard/{mock}'
  1414. },
  1415. 'admin.upgrade.data': {
  1416. 'real': '/clusters/{clusterName}/upgrades/{id}?upgrade_groups/UpgradeGroup/status!=PENDING&fields=' +
  1417. 'Upgrade/progress_percent,Upgrade/request_context,Upgrade/request_status,Upgrade/direction,' +
  1418. 'upgrade_groups/UpgradeGroup,' +
  1419. 'upgrade_groups/upgrade_items/UpgradeItem/status,' +
  1420. 'upgrade_groups/upgrade_items/UpgradeItem/context,' +
  1421. 'upgrade_groups/upgrade_items/UpgradeItem/group_id,' +
  1422. 'upgrade_groups/upgrade_items/UpgradeItem/progress_percent,' +
  1423. 'upgrade_groups/upgrade_items/UpgradeItem/request_id,' +
  1424. 'upgrade_groups/upgrade_items/UpgradeItem/skippable,' +
  1425. 'upgrade_groups/upgrade_items/UpgradeItem/stage_id,' +
  1426. 'upgrade_groups/upgrade_items/UpgradeItem/status,' +
  1427. 'upgrade_groups/upgrade_items/UpgradeItem/text&' +
  1428. 'minimal_response=true',
  1429. 'mock': '/data/stack_versions/upgrade.json'
  1430. },
  1431. 'admin.upgrade.state': {
  1432. 'real': '/clusters/{clusterName}/upgrades/{id}?fields=Upgrade',
  1433. 'mock': '/data/stack_versions/upgrade.json'
  1434. },
  1435. 'admin.upgrade.upgrade_item': {
  1436. 'real': '/clusters/{clusterName}/upgrades/{upgradeId}/upgrade_groups/{groupId}/upgrade_items/{stageId}?fields=' +
  1437. 'UpgradeItem/group_id,' +
  1438. 'UpgradeItem/stage_id,' +
  1439. 'tasks/Tasks/*&' +
  1440. 'minimal_response=true',
  1441. 'mock': '/data/stack_versions/upgrade_item.json'
  1442. },
  1443. 'admin.upgrade.start': {
  1444. 'real': '/clusters/{clusterName}/upgrades',
  1445. 'mock': '/data/stack_versions/start_upgrade.json',
  1446. 'type': 'POST',
  1447. 'format': function (data) {
  1448. return {
  1449. data: JSON.stringify({
  1450. "Upgrade": {
  1451. "repository_version": data.value
  1452. }
  1453. })
  1454. }
  1455. }
  1456. },
  1457. 'admin.downgrade.start': {
  1458. 'real': '/clusters/{clusterName}/upgrades',
  1459. 'mock': '/data/stack_versions/start_upgrade.json',
  1460. 'type': 'POST',
  1461. 'format': function (data) {
  1462. return {
  1463. data: JSON.stringify({
  1464. "Upgrade": {
  1465. "repository_version": data.value,
  1466. "force_downgrade": true
  1467. }
  1468. })
  1469. }
  1470. }
  1471. },
  1472. 'admin.upgrade.abort': {
  1473. 'real': '/clusters/{clusterName}/upgrades/{upgradeId}',
  1474. 'mock': '',
  1475. 'type': 'PUT',
  1476. 'format': function (data) {
  1477. return {
  1478. data: JSON.stringify({
  1479. "Upgrade": {
  1480. "request_status": "ABORTED"
  1481. }
  1482. })
  1483. }
  1484. }
  1485. },
  1486. 'admin.upgrade.upgradeItem.setState': {
  1487. 'real': '/clusters/{clusterName}/upgrades/{upgradeId}/upgrade_groups/{groupId}/upgrade_items/{itemId}',
  1488. 'mock': '',
  1489. type: 'PUT',
  1490. 'format': function (data) {
  1491. return {
  1492. data: JSON.stringify({
  1493. "UpgradeItem" : {
  1494. "status" : data.status
  1495. }
  1496. })
  1497. };
  1498. }
  1499. },
  1500. 'admin.stack_versions.all': {
  1501. 'real': '/clusters/{clusterName}/stack_versions?fields=ClusterStackVersions/*,repository_versions/RepositoryVersions/*&minimal_response=true',
  1502. 'mock': '/data/stack_versions/stack_version_all.json'
  1503. },
  1504. 'admin.stack_version.install.repo_version': {
  1505. 'real': '/clusters/{clusterName}/stack_versions',
  1506. 'format': function (data) {
  1507. return {
  1508. type: 'POST',
  1509. data: JSON.stringify({
  1510. ClusterStackVersions: data.ClusterStackVersions
  1511. })
  1512. }
  1513. },
  1514. 'mock': ''
  1515. },
  1516. 'admin.stack_versions.edit.repo': {
  1517. 'real': '/stacks/{stackName}/versions/{stackVersion}/repository_versions/{repoVersionId}',
  1518. 'mock': '',
  1519. 'type': 'PUT',
  1520. 'format': function (data) {
  1521. return {
  1522. data: JSON.stringify(data.repoVersion)
  1523. }
  1524. }
  1525. },
  1526. 'admin.stack_versions.validate.repo': {
  1527. 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems/{osType}/repositories/{repoId}?validate_only=true',
  1528. 'mock': '',
  1529. 'type': 'POST',
  1530. 'format': function (data) {
  1531. return {
  1532. data: JSON.stringify({
  1533. "Repositories": {
  1534. "base_url": data.baseUrl
  1535. }
  1536. })
  1537. }
  1538. }
  1539. },
  1540. 'admin.rolling_upgrade.pre_upgrade_check': {
  1541. 'real': '/clusters/{clusterName}/rolling_upgrades_check?fields=*&UpgradeChecks/repository_version={value}',
  1542. 'mock': '/data/stack_versions/pre_upgrade_check.json'
  1543. },
  1544. 'admin.kerberos_security.checks': {
  1545. //TODO when api will be known
  1546. 'real': '',
  1547. 'mock': '/data/stack_versions/pre_upgrade_check.json'
  1548. },
  1549. 'admin.kerberos_security.test_connection': {
  1550. 'real': '/kdc_check/{kdcHostname}',
  1551. 'mock': '',
  1552. 'format': function () {
  1553. return {
  1554. dataType: 'text'
  1555. };
  1556. }
  1557. },
  1558. 'admin.kerberos_security.regenerate_keytabs': {
  1559. 'real': '/clusters/{clusterName}?regenerate_keytabs={type}',
  1560. 'mock': '',
  1561. 'type': 'PUT',
  1562. 'format': function (data) {
  1563. return {
  1564. data: JSON.stringify({
  1565. "Clusters" : {
  1566. "security_type" : "KERBEROS"
  1567. }
  1568. })
  1569. }
  1570. }
  1571. },
  1572. 'wizard.advanced_repositories.valid_url': {
  1573. 'real': '/stacks/{stackName}/versions/{stackVersion}/operating_systems/{osType}/repositories/{repoId}',
  1574. 'mock': '',
  1575. 'type': 'PUT',
  1576. 'format': function (data) {
  1577. return {
  1578. data: JSON.stringify(data.data)
  1579. }
  1580. }
  1581. },
  1582. 'wizard.service_components': {
  1583. 'real': '{stackUrl}/services?fields=StackServices/*,components/*,components/dependencies/Dependencies/scope',
  1584. 'mock': '/data/stacks/HDP-2.1/service_components.json',
  1585. 'format': function (data) {
  1586. return {
  1587. timeout: 10000
  1588. };
  1589. }
  1590. },
  1591. 'wizard.step9.installer.get_host_status': {
  1592. 'real': '/clusters/{cluster}/hosts?fields=Hosts/host_state,host_components/HostRoles/state',
  1593. 'mock': '/data/wizard/deploy/5_hosts/get_host_state.json'
  1594. },
  1595. 'wizard.step9.load_log': {
  1596. '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',
  1597. 'mock': '/data/wizard/deploy/5_hosts/poll_{numPolls}.json',
  1598. 'format': function () {
  1599. return {
  1600. dataType: 'text'
  1601. };
  1602. }
  1603. },
  1604. 'wizard.step8.existing_cluster_names': {
  1605. 'real': '/clusters',
  1606. 'mock': ''
  1607. },
  1608. 'wizard.step8.create_cluster': {
  1609. 'real': '/clusters/{cluster}',
  1610. 'mock': '',
  1611. 'format': function (data) {
  1612. return {
  1613. type: 'POST',
  1614. dataType: 'text',
  1615. data: data.data
  1616. }
  1617. }
  1618. },
  1619. 'wizard.step8.create_selected_services': {
  1620. 'type': 'POST',
  1621. 'real': '/clusters/{cluster}/services',
  1622. 'mock': '/data/stacks/HDP-2.1/recommendations.json',
  1623. 'format': function (data) {
  1624. return {
  1625. dataType: 'text',
  1626. data: data.data
  1627. }
  1628. }
  1629. },
  1630. 'wizard.step8.create_components': {
  1631. 'real': '/clusters/{cluster}/services?ServiceInfo/service_name={serviceName}',
  1632. 'mock': '',
  1633. 'format': function (data) {
  1634. return {
  1635. type: 'POST',
  1636. dataType: 'text',
  1637. data: data.data
  1638. }
  1639. }
  1640. },
  1641. 'wizard.step8.register_host_to_cluster': {
  1642. 'real': '/clusters/{cluster}/hosts',
  1643. 'mock': '',
  1644. 'format': function (data) {
  1645. return {
  1646. type: 'POST',
  1647. dataType: 'text',
  1648. data: data.data
  1649. }
  1650. }
  1651. },
  1652. 'wizard.step8.register_host_to_component': {
  1653. 'real': '/clusters/{cluster}/hosts',
  1654. 'mock': '',
  1655. 'format': function (data) {
  1656. return {
  1657. type: 'POST',
  1658. dataType: 'text',
  1659. data: data.data
  1660. }
  1661. }
  1662. },
  1663. 'wizard.step8.apply_configuration_groups': {
  1664. 'real': '/clusters/{cluster}/config_groups',
  1665. 'mock': '',
  1666. 'format': function (data) {
  1667. return {
  1668. type: 'POST',
  1669. dataType: 'text',
  1670. data: data.data
  1671. }
  1672. }
  1673. },
  1674. 'wizard.step8.set_local_repos': {
  1675. 'real': '{stackVersionURL}/operating_systems/{osType}/repositories/{repoId}',
  1676. 'mock': '',
  1677. 'format': function (data) {
  1678. return {
  1679. type: 'PUT',
  1680. dataType: 'text',
  1681. data: data.data
  1682. }
  1683. }
  1684. },
  1685. 'wizard.step3.jdk_check': {
  1686. 'real': '/requests',
  1687. 'mock': '',
  1688. 'format': function (data) {
  1689. return {
  1690. type: 'POST',
  1691. data: JSON.stringify({
  1692. "RequestInfo": {
  1693. "context": "Check hosts",
  1694. "action": "check_host",
  1695. "parameters": {
  1696. "threshold": "60",
  1697. "java_home": data.java_home,
  1698. "jdk_location": data.jdk_location,
  1699. "check_execute_list": "java_home_check"
  1700. }
  1701. },
  1702. "Requests/resource_filters": [{
  1703. "hosts": data.host_names
  1704. }]
  1705. })
  1706. }
  1707. }
  1708. },
  1709. 'wizard.step3.jdk_check.get_results': {
  1710. 'real': '/requests/{requestIndex}?fields=*,tasks/Tasks/host_name,tasks/Tasks/status,tasks/Tasks/structured_out',
  1711. 'mock': '/data/requests/host_check/jdk_check_results.json'
  1712. },
  1713. 'wizard.step3.host_info': {
  1714. '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',
  1715. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1716. 'format': function () {
  1717. return {
  1718. contentType: 'application/json'
  1719. };
  1720. }
  1721. },
  1722. 'wizard.loadrecommendations': {
  1723. 'real': '{stackVersionUrl}/recommendations',
  1724. 'mock': '/data/stacks/HDP-2.1/recommendations.json',
  1725. 'type': 'POST',
  1726. 'format': function (data) {
  1727. var q = {
  1728. hosts: data.hosts,
  1729. services: data.services,
  1730. recommend: data.recommend
  1731. };
  1732. if (data.recommendations) {
  1733. q.recommendations = data.recommendations;
  1734. }
  1735. return {
  1736. data: JSON.stringify(q)
  1737. }
  1738. }
  1739. },
  1740. // TODO: merge with wizard.loadrecommendations query
  1741. 'config.recommendations': {
  1742. 'real': '{stackVersionUrl}/recommendations',
  1743. 'mock': '/data/configurations/recommendations/configuration_dependencies.json',
  1744. //'mock': '/data/stacks/HDP-2.1/recommendations_configs.json',
  1745. 'type': 'POST',
  1746. 'format': function (data) {
  1747. return {
  1748. data: JSON.stringify(data.dataToSend)
  1749. }
  1750. }
  1751. },
  1752. 'config.validations': {
  1753. 'real': '{stackVersionUrl}/validations',
  1754. 'mock': '/data/stacks/HDP-2.1/validations.json',
  1755. 'type': 'POST',
  1756. 'format': function (data) {
  1757. return {
  1758. data: JSON.stringify({
  1759. hosts: data.hosts,
  1760. services: data.services,
  1761. validate: data.validate,
  1762. recommendations: data.recommendations
  1763. })
  1764. }
  1765. }
  1766. },
  1767. 'preinstalled.checks': {
  1768. 'real': '/requests',
  1769. 'mock': '',
  1770. 'format': function (data) {
  1771. return {
  1772. type: 'POST',
  1773. data: JSON.stringify({
  1774. "RequestInfo": data.RequestInfo,
  1775. "Requests/resource_filters": [data.resource_filters]
  1776. })
  1777. }
  1778. }
  1779. },
  1780. 'preinstalled.checks.tasks': {
  1781. 'real': '/requests/{requestId}?fields=tasks/Tasks,Requests/inputs,Requests/request_status',
  1782. 'mock': '/data/requests/host_check/1.json'
  1783. },
  1784. 'wizard.step3.rerun_checks': {
  1785. 'real': '/hosts?fields=Hosts/last_agent_env',
  1786. 'mock': '/data/wizard/bootstrap/two_hosts_information.json',
  1787. 'format': function () {
  1788. return {
  1789. contentType: 'application/json'
  1790. };
  1791. }
  1792. },
  1793. 'wizard.step3.bootstrap': {
  1794. 'real': '/bootstrap/{bootRequestId}',
  1795. 'mock': '/data/wizard/bootstrap/poll_{numPolls}.json'
  1796. },
  1797. 'wizard.step3.is_hosts_registered': {
  1798. 'real': '/hosts?fields=Hosts/host_status',
  1799. 'mock': '/data/wizard/bootstrap/single_host_registration.json'
  1800. },
  1801. 'wizard.stacks': {
  1802. 'real': '/stacks',
  1803. 'mock': '/data/wizard/stack/stacks2.json'
  1804. },
  1805. 'wizard.stacks_versions': {
  1806. 'real': '/stacks/{stackName}/versions?fields=Versions,operating_systems/repositories/Repositories',
  1807. 'mock': '/data/wizard/stack/{stackName}_versions.json'
  1808. },
  1809. 'wizard.launch_bootstrap': {
  1810. 'real': '/bootstrap',
  1811. 'mock': '/data/wizard/bootstrap/bootstrap.json',
  1812. 'type': 'POST',
  1813. 'format': function (data) {
  1814. return {
  1815. contentType: 'application/json',
  1816. data: data.bootStrapData,
  1817. popup: data.popup
  1818. }
  1819. }
  1820. },
  1821. 'router.login': {
  1822. 'real': '/users/{loginName}?fields=*,privileges/PrivilegeInfo/cluster_name,privileges/PrivilegeInfo/permission_name',
  1823. 'mock': '/data/users/user_{usr}.json',
  1824. 'format': function (data) {
  1825. var statusCode = jQuery.extend({}, require('data/statusCodes'));
  1826. statusCode['403'] = function () {
  1827. console.log("Error code 403: Forbidden.");
  1828. };
  1829. return {
  1830. statusCode: statusCode
  1831. };
  1832. }
  1833. },
  1834. 'users.all': {
  1835. real: '/users/?fields=*',
  1836. mock: '/data/users/users.json'
  1837. },
  1838. 'users.privileges': {
  1839. real: '/privileges?fields=*',
  1840. mock: '/data/users/privileges.json'
  1841. },
  1842. 'router.user.privileges': {
  1843. real: '/privileges?PrivilegeInfo/principal_name={userName}&fields=*',
  1844. mock: '/data/users/privileges_{userName}.json'
  1845. },
  1846. 'router.login.clusters': {
  1847. 'real': '/clusters?fields=Clusters/provisioning_state',
  1848. 'mock': '/data/clusters/info.json'
  1849. },
  1850. 'router.logoff': {
  1851. 'real': '/logout',
  1852. 'mock': ''
  1853. },
  1854. 'ambari.service.load_jdk_name': {
  1855. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/jdk.name,RootServiceComponents/properties/java.home,RootServiceComponents/properties/jdk_location',
  1856. 'mock': '/data/requests/host_check/jdk_name.json'
  1857. },
  1858. 'ambari.service.load_server_version': {
  1859. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true',
  1860. 'mock': '/data/ambari_components/component_version.json'
  1861. },
  1862. 'ambari.service': {
  1863. 'real': '/services/AMBARI/components/AMBARI_SERVER',
  1864. 'mock': '/data/services/ambari_server.json'
  1865. },
  1866. 'ambari.service.load_server_clock': {
  1867. 'real': '/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/server_clock',
  1868. 'mock': ''
  1869. },
  1870. 'config_groups.create': {
  1871. 'real': '/clusters/{clusterName}/config_groups',
  1872. 'mock': '',
  1873. 'format': function (data) {
  1874. return {
  1875. type: 'POST',
  1876. data: JSON.stringify([{
  1877. "ConfigGroup": {
  1878. "group_name": data.group_name,
  1879. "tag": data.service_id,
  1880. "description": data.description,
  1881. "desired_configs": data.desired_configs,
  1882. "hosts": data.hosts
  1883. }
  1884. }])
  1885. }
  1886. }
  1887. },
  1888. 'config_groups.update': {
  1889. 'real': '/clusters/{clusterName}/config_groups/{id}',
  1890. 'mock': '',
  1891. 'format': function (data) {
  1892. return {
  1893. type: 'PUT',
  1894. data: JSON.stringify(data.data)
  1895. }
  1896. }
  1897. },
  1898. 'rolling_restart.post': {
  1899. 'real': '/clusters/{clusterName}/request_schedules',
  1900. 'mock': '',
  1901. 'format': function (data) {
  1902. return {
  1903. type: 'POST',
  1904. data: JSON.stringify([{
  1905. "RequestSchedule": {
  1906. "batch": [{
  1907. "requests": data.batches
  1908. }, {
  1909. "batch_settings": {
  1910. "batch_separation_in_seconds": data.intervalTimeSeconds,
  1911. "task_failure_tolerance": data.tolerateSize
  1912. }
  1913. }]
  1914. }
  1915. }])
  1916. }
  1917. }
  1918. },
  1919. 'request_schedule.get': {
  1920. 'real': '/clusters/{clusterName}/request_schedules/{request_schedule_id}',
  1921. 'mock': ''
  1922. },
  1923. 'restart.hostComponents': {
  1924. 'real': '/clusters/{clusterName}/requests',
  1925. 'mock': '',
  1926. 'format': function (data) {
  1927. return {
  1928. type: 'POST',
  1929. data: JSON.stringify({
  1930. "RequestInfo": {
  1931. "command": "RESTART",
  1932. "context": data.context,
  1933. "operation_level": data.operation_level
  1934. },
  1935. "Requests/resource_filters": data.resource_filters
  1936. })
  1937. }
  1938. }
  1939. },
  1940. 'bulk_request.decommission': {
  1941. 'real': '/clusters/{clusterName}/requests',
  1942. 'mock': '',
  1943. 'format': function (data) {
  1944. return {
  1945. type: 'POST',
  1946. data: JSON.stringify({
  1947. 'RequestInfo': {
  1948. 'context': data.context,
  1949. 'command': 'DECOMMISSION',
  1950. 'parameters': data.parameters,
  1951. 'operation_level': {
  1952. 'level': "CLUSTER",
  1953. 'cluster_name': data.clusterName
  1954. }
  1955. },
  1956. "Requests/resource_filters": [{"service_name": data.serviceName, "component_name": data.componentName}]
  1957. })
  1958. }
  1959. }
  1960. },
  1961. 'bulk_request.hosts.passive_state': {
  1962. 'real': '/clusters/{clusterName}/hosts',
  1963. 'mock': '',
  1964. 'format': function (data) {
  1965. return {
  1966. type: 'PUT',
  1967. data: JSON.stringify({
  1968. RequestInfo: {
  1969. context: data.requestInfo,
  1970. query: 'Hosts/host_name.in(' + data.hostNames + ')'
  1971. },
  1972. Body: {
  1973. Hosts: {
  1974. maintenance_state: data.passive_state
  1975. }
  1976. }
  1977. })
  1978. }
  1979. }
  1980. },
  1981. 'bulk_request.hosts.update_rack_id': {
  1982. 'real': '/clusters/{clusterName}/hosts',
  1983. 'mock': '',
  1984. 'format': function(data) {
  1985. return {
  1986. type: 'PUT',
  1987. data: JSON.stringify({
  1988. RequestInfo: {
  1989. context: data.requestInfo,
  1990. query: 'Hosts/host_name.in(' + data.hostNames + ')'
  1991. },
  1992. Body: {
  1993. Hosts: {
  1994. rack_info: data.rackId
  1995. }
  1996. }
  1997. })
  1998. }
  1999. }
  2000. },
  2001. 'bulk_request.hosts.all_components.passive_state': {
  2002. 'real': '/clusters/{clusterName}/host_components',
  2003. 'mock': '',
  2004. 'format': function (data) {
  2005. return {
  2006. type: 'PUT',
  2007. data: JSON.stringify({
  2008. RequestInfo: {
  2009. context: data.requestInfo,
  2010. query: data.query
  2011. },
  2012. Body: {
  2013. HostRoles: {
  2014. maintenance_state: data.passive_state
  2015. }
  2016. }
  2017. })
  2018. }
  2019. }
  2020. },
  2021. 'views.info': {
  2022. 'real': '/views',
  2023. 'mock': '/data/views/views.json'
  2024. },
  2025. /**
  2026. * Get all instances of all views across versions
  2027. */
  2028. 'views.instances': {
  2029. 'real': '/views?fields=versions/instances/ViewInstanceInfo,versions/ViewVersionInfo/label&versions/ViewVersionInfo/system=false',
  2030. 'mock': '/data/views/instances.json'
  2031. },
  2032. 'host.host_component.flume.metrics': {
  2033. 'real': '/clusters/{clusterName}/hosts/{hostName}/host_components/FLUME_HANDLER?fields=metrics/flume/flume/{flumeComponent}/*',
  2034. 'mock': ''
  2035. },
  2036. 'host.host_component.flume.metrics.timeseries': {
  2037. 'real': '',
  2038. 'mock': '',
  2039. format: function (data) {
  2040. return {
  2041. url: data.url
  2042. }
  2043. }
  2044. },
  2045. 'host.host_components.filtered': {
  2046. 'real': '/clusters/{clusterName}/hosts?{fields}',
  2047. 'mock': '',
  2048. format: function (data) {
  2049. return {
  2050. headers: {
  2051. 'X-Http-Method-Override': 'GET'
  2052. },
  2053. type: 'POST',
  2054. data: JSON.stringify({
  2055. "RequestInfo": {"query": data.parameters}
  2056. })
  2057. };
  2058. }
  2059. },
  2060. 'host.status.counters': {
  2061. 'real': '/clusters/{clusterName}?fields=Clusters/health_report,Clusters/total_hosts,alerts_summary_hosts&minimal_response=true',
  2062. 'mock': '/data/hosts/HDP2/host_status_counters.json'
  2063. },
  2064. 'host.stack_versions.install': {
  2065. 'real': '/clusters/{clusterName}/hosts/{hostName}/stack_versions',
  2066. 'mock': '',
  2067. 'type': 'POST',
  2068. 'format': function (data) {
  2069. return {
  2070. data: JSON.stringify({
  2071. "HostStackVersions": {
  2072. "stack": data.version.get('stack'),
  2073. "version": data.version.get('version'),
  2074. "repository_version": data.version.get('repoVersion')
  2075. }
  2076. })
  2077. }
  2078. }
  2079. },
  2080. 'components.filter_by_status': {
  2081. 'real': '/clusters/{clusterName}/components?fields=host_components/HostRoles/host_name,ServiceComponentInfo/component_name,ServiceComponentInfo/started_count{urlParams}&minimal_response=true',
  2082. 'mock': ''
  2083. },
  2084. 'hosts.all.install': {
  2085. 'real': '/hosts?minimal_response=true',
  2086. 'mock': ''
  2087. },
  2088. 'hosts.all': {
  2089. 'real': '/clusters/{clusterName}/hosts?minimal_response=true',
  2090. 'mock': '/data/hosts/HDP2/hosts.json'
  2091. },
  2092. 'hosts.with_public_host_names': {
  2093. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/public_host_name&minimal_response=true',
  2094. 'mock': ''
  2095. },
  2096. 'hosts.for_quick_links': {
  2097. 'real': '/clusters/{clusterName}/hosts?Hosts/host_name.in({masterHosts})&fields=Hosts/public_host_name,host_components/HostRoles/component_name{urlParams}&minimal_response=true',
  2098. 'mock': '/data/hosts/quick_links.json'
  2099. },
  2100. 'hosts.confirmed.install': {
  2101. 'real': '/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
  2102. 'mock': ''
  2103. },
  2104. 'hosts.confirmed': {
  2105. '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',
  2106. 'mock': '/data/hosts/HDP2/hosts.json'
  2107. },
  2108. 'host_components.all': {
  2109. 'real': '/clusters/{clusterName}/host_components?fields=HostRoles/host_name&minimal_response=true',
  2110. 'mock': ''
  2111. },
  2112. 'host_components.with_services_names': {
  2113. 'real': '/clusters/{clusterName}/host_components?fields=component/ServiceComponentInfo/service_name,HostRoles/host_name&minimal_response=true',
  2114. 'mock': ''
  2115. },
  2116. 'components.get_installed': {
  2117. 'real': '/clusters/{clusterName}/components',
  2118. 'mock': ''
  2119. },
  2120. 'hosts.heatmaps': {
  2121. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/rack_info,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',
  2122. 'mock': '/data/hosts/HDP2/hosts.json'
  2123. },
  2124. 'namenode.cpu_wio': {
  2125. 'real': '/clusters/{clusterName}/hosts/{nnHost}?fields=metrics/cpu',
  2126. 'mock': '/data/cluster_metrics/cpu.json'
  2127. },
  2128. 'custom_action.create': {
  2129. 'real': '/requests',
  2130. 'mock': '',
  2131. 'format': function (data) {
  2132. var requestInfo = {
  2133. context: 'Check host',
  2134. action: 'check_host',
  2135. parameters: {}
  2136. };
  2137. $.extend(true, requestInfo, data.requestInfo);
  2138. return {
  2139. type: 'POST',
  2140. data: JSON.stringify({
  2141. 'RequestInfo': requestInfo,
  2142. 'Requests/resource_filters': [{
  2143. hosts: data.filteredHosts.join(',')
  2144. }]
  2145. })
  2146. }
  2147. }
  2148. },
  2149. 'custom_action.request': {
  2150. 'real': '/requests/{requestId}/tasks/{taskId}',
  2151. 'mock': '/data/requests/1.json',
  2152. 'format': function (data) {
  2153. return {
  2154. requestId: data.requestId,
  2155. taskId: data.taskId || ''
  2156. }
  2157. }
  2158. },
  2159. 'hosts.high_availability.wizard': {
  2160. 'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem&minimal_response=true',
  2161. 'mock': ''
  2162. },
  2163. 'hosts.security.wizard': {
  2164. 'real': '/clusters/{clusterName}/hosts?fields=host_components/HostRoles/service_name&minimal_response=true',
  2165. 'mock': ''
  2166. },
  2167. 'host_component.installed.on_hosts': {
  2168. 'real': '/clusters/{clusterName}/host_components?HostRoles/component_name={componentName}&HostRoles/host_name.in({hostNames})&fields=HostRoles/host_name&minimal_response=true',
  2169. 'mock': ''
  2170. },
  2171. 'hosts.by_component.one': {
  2172. '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',
  2173. 'mock': ''
  2174. },
  2175. 'hosts.by_component.all': {
  2176. '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',
  2177. 'mock': ''
  2178. },
  2179. 'hosts.config_groups': {
  2180. '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',
  2181. 'mock': ''
  2182. },
  2183. 'hosts.host_components.pre_load': {
  2184. real: '',
  2185. mock: '/data/hosts/HDP2/hosts.json',
  2186. format: function (data) {
  2187. return {
  2188. url: data.url
  2189. }
  2190. }
  2191. },
  2192. 'hosts.bulk.operations': {
  2193. real: '/clusters/{clusterName}/hosts?fields=Hosts/host_name,Hosts/maintenance_state,' +
  2194. 'host_components/HostRoles/state,host_components/HostRoles/maintenance_state,' +
  2195. 'Hosts/total_mem,stack_versions/HostStackVersions,stack_versions/repository_versions/RepositoryVersions/repository_version,' +
  2196. 'stack_versions/repository_versions/RepositoryVersions/id,' +
  2197. 'host_components/HostRoles/stale_configs&minimal_response=true',
  2198. mock: '',
  2199. format: function (data) {
  2200. return {
  2201. headers: {
  2202. 'X-Http-Method-Override': 'GET'
  2203. },
  2204. type: 'POST',
  2205. data: JSON.stringify({
  2206. "RequestInfo": {"query": data.parameters}
  2207. })
  2208. }
  2209. }
  2210. },
  2211. 'service.serviceConfigVersions.get': {
  2212. real: '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&fields=service_config_version,user,hosts,group_id,group_name,is_current,createtime,service_name,service_config_version_note&minimal_response=true',
  2213. mock: '/data/configurations/service_versions.json'
  2214. },
  2215. 'service.serviceConfigVersions.get.current': {
  2216. real: '/clusters/{clusterName}?fields=Clusters/desired_service_config_versions&minimal_response=true',
  2217. mock: ''
  2218. },
  2219. 'service.serviceConfigVersions.get.total': {
  2220. real: '/clusters/{clusterName}/configurations/service_config_versions?page_size=1&minimal_response=true',
  2221. mock: '/data/configurations/service_versions_total.json'
  2222. },
  2223. 'service.serviceConfigVersion.get': {
  2224. real: '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&service_config_version={serviceConfigVersion}',
  2225. mock: '/data/configurations/service_version.json'
  2226. },
  2227. 'service.serviceConfigVersions.get.multiple': {
  2228. real: '/clusters/{clusterName}/configurations/service_config_versions?service_name={serviceName}&service_config_version.in({serviceConfigVersions})',
  2229. mock: '/data/configurations/service_version.json',
  2230. format: function (data) {
  2231. return {
  2232. serviceConfigVersions: data.serviceConfigVersions.join(',')
  2233. }
  2234. }
  2235. },
  2236. 'service.serviceConfigVersion.revert': {
  2237. 'real': '/clusters/{clusterName}',
  2238. 'mock': '',
  2239. 'type': 'PUT',
  2240. 'format': function (data) {
  2241. return {
  2242. data: JSON.stringify(data.data)
  2243. }
  2244. }
  2245. },
  2246. 'service.mysql.clean': {
  2247. 'real': '/clusters/{clusterName}/requests',
  2248. 'mock': '',
  2249. 'format': function (data) {
  2250. return {
  2251. type: 'POST',
  2252. data: JSON.stringify({
  2253. "RequestInfo": {
  2254. "command" : "CLEAN", "context" : "Clean MYSQL Server"
  2255. },
  2256. "Requests/resource_filters": [{
  2257. "service_name" : "HIVE",
  2258. "component_name" : "MYSQL_SERVER",
  2259. "hosts": data.host
  2260. }]
  2261. })
  2262. }
  2263. }
  2264. },
  2265. 'service.mysql.configure': {
  2266. 'real': '/clusters/{clusterName}/requests',
  2267. 'mock': '',
  2268. 'format': function (data) {
  2269. return {
  2270. type: 'POST',
  2271. data: JSON.stringify({
  2272. "RequestInfo": {
  2273. "command" : "CONFIGURE", "context" : "Configure MYSQL Server"
  2274. },
  2275. "Requests/resource_filters": [{
  2276. "service_name" : "HIVE",
  2277. "component_name" : "MYSQL_SERVER",
  2278. "hosts": data.host
  2279. }]
  2280. })
  2281. }
  2282. }
  2283. },
  2284. 'service.mysql.testHiveConnection': {
  2285. 'real': '/requests',
  2286. 'mock': '',
  2287. 'format': function (data) {
  2288. return {
  2289. type: 'POST',
  2290. data: JSON.stringify({
  2291. "RequestInfo": {
  2292. "context": "Check host",
  2293. "action": "check_host",
  2294. "parameters":{
  2295. "db_name": data.db_name,
  2296. "user_name": data.db_user,
  2297. "user_passwd": data.db_pass,
  2298. "db_connection_url": data.db_connection_url,
  2299. "jdk_location": data.jdk_location,
  2300. "threshold":"60",
  2301. "ambari_server_host": "c6403.ambari.apache.org",
  2302. "check_execute_list":"db_connection_check",
  2303. "java_home": data.java_home,
  2304. "jdk_name": data.jdk_name
  2305. }
  2306. },
  2307. "Requests/resource_filters": [{"hosts": data.hosts}]})
  2308. }
  2309. }
  2310. }
  2311. };
  2312. /**
  2313. * Replace data-placeholders to its values
  2314. *
  2315. * @param {String} url
  2316. * @param {Object} data
  2317. * @return {String}
  2318. */
  2319. var formatUrl = function (url, data) {
  2320. if (!url) return null;
  2321. var keys = url.match(/\{\w+\}/g);
  2322. keys = (keys === null) ? [] : keys;
  2323. if (keys) {
  2324. keys.forEach(function (key) {
  2325. var raw_key = key.substr(1, key.length - 2);
  2326. var replace;
  2327. if (!data || !data[raw_key]) {
  2328. replace = '';
  2329. }
  2330. else {
  2331. replace = data[raw_key];
  2332. }
  2333. url = url.replace(new RegExp(key, 'g'), replace);
  2334. });
  2335. }
  2336. return url;
  2337. };
  2338. /**
  2339. * this = object from config
  2340. * @return {Object}
  2341. */
  2342. var formatRequest = function (data) {
  2343. var opt = {
  2344. type: this.type || 'GET',
  2345. timeout: App.timeout,
  2346. dataType: 'json',
  2347. statusCode: require('data/statusCodes')
  2348. };
  2349. if (App.get('testMode')) {
  2350. opt.url = formatUrl(this.mock ? this.mock : '', data);
  2351. opt.type = 'GET';
  2352. }
  2353. else {
  2354. var prefix = this.apiPrefix != null ? this.apiPrefix : App.apiPrefix;
  2355. opt.url = prefix + formatUrl(this.real, data);
  2356. }
  2357. if (this.format) {
  2358. jQuery.extend(opt, this.format(data, opt));
  2359. }
  2360. return opt;
  2361. };
  2362. /**
  2363. * Wrapper for all ajax requests
  2364. *
  2365. * @type {Object}
  2366. */
  2367. var ajax = Em.Object.extend({
  2368. /**
  2369. * Send ajax request
  2370. *
  2371. * @param {Object} config
  2372. * @return {$.ajax} jquery ajax object
  2373. *
  2374. * config fields:
  2375. * name - url-key in the urls-object *required*
  2376. * sender - object that send request (need for proper callback initialization) *required*
  2377. * data - object with data for url-format
  2378. * beforeSend - method-name for ajax beforeSend response callback
  2379. * success - method-name for ajax success response callback
  2380. * error - method-name for ajax error response callback
  2381. * callback - callback from <code>App.updater.run</code> library
  2382. */
  2383. send: function (config) {
  2384. if (!config.sender) {
  2385. console.warn('Ajax sender should be defined!');
  2386. return null;
  2387. }
  2388. // default parameters
  2389. var params = {
  2390. clusterName: (App.get('clusterName') || App.clusterStatus.get('clusterName'))
  2391. };
  2392. // extend default parameters with provided
  2393. if (config.data) {
  2394. jQuery.extend(params, config.data);
  2395. }
  2396. var opt = {};
  2397. if (!urls[config.name]) {
  2398. console.warn('Invalid name provided!');
  2399. return null;
  2400. }
  2401. opt = formatRequest.call(urls[config.name], params);
  2402. opt.context = this;
  2403. // object sender should be provided for processing beforeSend, success and error responses
  2404. opt.beforeSend = function (xhr) {
  2405. if (config.beforeSend) {
  2406. config.sender[config.beforeSend](opt, xhr, params);
  2407. }
  2408. };
  2409. opt.success = function (data, textStatus, request) {
  2410. console.log("TRACE: The url is: " + opt.url);
  2411. if (config.success) {
  2412. config.sender[config.success](data, opt, params, request);
  2413. }
  2414. };
  2415. opt.error = function (request, ajaxOptions, error) {
  2416. var KDCErrorMsg = this.getKDCErrorMgs(request);
  2417. if (!Em.isNone(KDCErrorMsg)) {
  2418. /**
  2419. * run this handler before show KDC error popup
  2420. */
  2421. if (config.kdcFailHandler) {
  2422. config.sender[config.kdcFailHandler](request, ajaxOptions, error, opt, params);
  2423. }
  2424. /**
  2425. * run this handler when click cancle on KDC error popup
  2426. */
  2427. if (config.kdcCancelHandler) {
  2428. opt.kdcCancelHandler = function() {
  2429. config.sender[config.kdcCancelHandler]();
  2430. };
  2431. }
  2432. this.defaultErrorKDCHandler(opt, KDCErrorMsg);
  2433. } else if (config.error) {
  2434. config.sender[config.error](request, ajaxOptions, error, opt, params);
  2435. } else {
  2436. this.defaultErrorHandler(request, opt.url, opt.type);
  2437. }
  2438. };
  2439. opt.complete = function () {
  2440. if (config.callback) {
  2441. config.callback();
  2442. }
  2443. };
  2444. if ($.mocho) {
  2445. opt.url = 'http://' + $.hostName + opt.url;
  2446. }
  2447. return $.ajax(opt);
  2448. },
  2449. // A single instance of App.ModalPopup view
  2450. modalPopup: null,
  2451. /**
  2452. * defaultErrorHandler function is referred from App.ajax.send function and App.HttpClient.defaultErrorHandler function
  2453. * @jqXHR {jqXHR Object}
  2454. * @url {string}
  2455. * @method {String} Http method
  2456. * @showStatus {number} HTTP response code which should be shown. Default is 500.
  2457. */
  2458. defaultErrorHandler: function (jqXHR, url, method, showStatus) {
  2459. method = method || 'GET';
  2460. var self = this;
  2461. try {
  2462. var json = $.parseJSON(jqXHR.responseText);
  2463. var message = json.message;
  2464. } catch (err) {
  2465. }
  2466. if (!showStatus) {
  2467. showStatus = 500;
  2468. }
  2469. if (jqXHR.status === showStatus && !this.get('modalPopup')) {
  2470. this.set('modalPopup', App.ModalPopup.show({
  2471. header: Em.I18n.t('common.error'),
  2472. secondary: false,
  2473. onPrimary: function () {
  2474. this.hide();
  2475. self.set('modalPopup', null);
  2476. },
  2477. bodyClass: App.AjaxDefaultErrorPopupBodyView.extend({
  2478. type: method,
  2479. url: url,
  2480. status: jqXHR.status,
  2481. message: message
  2482. })
  2483. }));
  2484. }
  2485. },
  2486. /**
  2487. * defines if it's admin session expiration error
  2488. * and if so returns short error message
  2489. * @param jqXHR
  2490. * @returns {string|null}
  2491. */
  2492. getKDCErrorMgs: function(jqXHR) {
  2493. try {
  2494. var message = $.parseJSON(jqXHR.responseText).message;
  2495. } catch (err) {}
  2496. if (jqXHR.status === 400 && message) {
  2497. return App.format.kdcErrorMsg(message, true);
  2498. }
  2499. },
  2500. /**
  2501. * default handler for admin session expiration error
  2502. * @param {object} opt
  2503. * @param {string} msg
  2504. * @returns {*}
  2505. */
  2506. defaultErrorKDCHandler: function(opt, msg) {
  2507. return App.showInvalidKDCPopup(opt, msg);
  2508. }
  2509. });
  2510. /**
  2511. * Add few access-methods for test purposes
  2512. */
  2513. if ($.mocho) {
  2514. ajax.reopen({
  2515. /**
  2516. * Don't use it anywhere except tests!
  2517. * @returns {Array}
  2518. */
  2519. fakeGetUrlNames: function () {
  2520. return Em.keys(urls);
  2521. },
  2522. /**
  2523. * Don't use it anywhere except tests!
  2524. * @param name
  2525. * @returns {*}
  2526. */
  2527. fakeGetUrl: function (name) {
  2528. return urls[name];
  2529. },
  2530. /**
  2531. * Don't use it anywhere except tests!
  2532. * @param url
  2533. * @param data
  2534. * @returns {String}
  2535. */
  2536. fakeFormatUrl: function (url, data) {
  2537. return formatUrl(url, data);
  2538. },
  2539. /**
  2540. * Don't use it anywhere except tests!
  2541. * @param urlObj
  2542. * @param data
  2543. * @returns {Object}
  2544. */
  2545. fakeFormatRequest: function (urlObj, data) {
  2546. return formatRequest.call(urlObj, data);
  2547. }
  2548. });
  2549. }
  2550. App.ajax = ajax.create({});