/[eiffelstudio]/trunk/Src/web/eiffel-cloud/modules/es_cloud/webapi/es_cloud_module_webapi.e
ViewVC logotype

Contents of /trunk/Src/web/eiffel-cloud/modules/es_cloud/webapi/es_cloud_module_webapi.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 103675 - (show annotations)
Tue Nov 12 12:35:53 2019 UTC (2 months, 1 week ago) by jfiat
File size: 2452 byte(s)
Added webapi to access the plans.
1 note
2 description: "Summary description for {ES_CLOUD_MODULE}."
3 date: "$Date$"
4 revision: "$Revision$"
5
6 class
7 ES_CLOUD_MODULE_WEBAPI
8
9 inherit
10 CMS_MODULE_WEBAPI [ES_CLOUD_MODULE]
11 redefine
12 setup_hooks
13 end
14
15 CMS_HOOK_WEBAPI_RESPONSE_ALTER
16
17 CMS_HOOK_AUTO_REGISTER
18
19 create
20 make
21
22 feature {NONE} -- Router/administration
23
24 setup_webapi_router (a_router: WSF_ROUTER; a_api: CMS_API)
25 -- <Precursor>
26 local
27 l_root: ES_CLOUD_ROOT_WEBAPI_HANDLER
28 l_plans: ES_CLOUD_PLANS_WEBAPI_HANDLER
29 l_account: ES_CLOUD_ACCOUNT_WEBAPI_HANDLER
30 l_inst_hlr: ES_CLOUD_INSTALLATIONS_WEBAPI_HANDLER
31 do
32 if attached module.es_cloud_api as l_mod_api then
33 create l_root.make (l_mod_api)
34 a_router.handle ("/cloud", l_root, a_router.methods_get)
35 -- FIXME: switch earlier for version. Using WSF_ROUTING_HANDLER.
36 a_router.handle ("/cloud/{version}/", l_root, a_router.methods_get)
37 create l_plans.make (l_mod_api)
38 a_router.handle ("/cloud/{version}/plan/", l_plans, a_router.methods_get)
39 a_router.handle ("/cloud/{version}/plan/{pid}", l_plans, a_router.methods_get)
40 create l_account.make (l_mod_api)
41 a_router.handle ("/cloud/{version}/account/", l_account, a_router.methods_get)
42 a_router.handle ("/cloud/{version}/account/{uid}", l_account, a_router.methods_get)
43 create l_inst_hlr.make (l_mod_api)
44 a_router.handle ("/cloud/{version}/account/{uid}/installations", l_inst_hlr, a_router.methods_get_post)
45 a_router.handle ("/cloud/{version}/account/{uid}/installations/{installation_id}", l_inst_hlr, a_router.methods_get_put_delete)
46 a_router.handle ("/cloud/{version}/account/{uid}/installations/{installation_id}/session/", l_inst_hlr, a_router.methods_get)
47 a_router.handle ("/cloud/{version}/account/{uid}/installations/{installation_id}/session/{session_id}", l_inst_hlr, a_router.methods_get)
48 end
49 end
50
51 feature -- Hooks configuration
52
53 setup_hooks (a_hooks: CMS_HOOK_CORE_MANAGER)
54 -- Module hooks configuration.
55 do
56 a_hooks.subscribe_to_webapi_response_alter_hook (Current)
57 end
58
59 feature -- Hook
60
61 webapi_response_alter (rep: WEBAPI_RESPONSE)
62 do
63 if
64 attached {HM_WEBAPI_RESPONSE} rep as hm and then
65 rep.is_root
66 then
67 hm.add_link ("es:cloud", Void, rep.api.webapi_path ("cloud"))
68 end
69 end
70
71 note
72 copyright: "2011-2017, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
73 license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
74 end

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23