ajax.js 84 KB

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