ajax.js 108 KB

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