ajax.js 86 KB

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