ajax.js 85 KB

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