ajax.js 107 KB

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