Merge "Add common openstack opertation scenarios: network"
[yardstick.git] / gui / app / scripts / factory / main.factory.js
1 'use strict';
2
3 /**
4  * get data factory
5  */
6
7
8 var Base_URL;
9 var Grafana_URL;
10
11 angular.module('yardStickGui2App')
12     .factory('mainFactory', ['$resource','$rootScope','$http', '$location',function($resource, $rootScope,$http,$location) {
13
14         Base_URL = 'http://' + $location.host() + ':' + $location.port();
15         Grafana_URL = 'http://' + $location.host();
16
17         return {
18
19             postEnvironmentVariable: function() {
20                 return $resource(Base_URL + '/api/v2/yardstick/openrcs', {}, {
21                     'post': {
22                         method: 'POST'
23                     }
24                 })
25             },
26             uploadOpenrc: function() {
27                 return $resource(Base_URL + '/ap/v2/yardstick/openrcs', {}, {
28                     'post': {
29                         method: 'POST'
30                     }
31                 })
32             },
33             getEnvironmentList: function() {
34                 return $resource(Base_URL+ '/api/v2/yardstick/environments', {}, {
35                     'get': {
36                         method: 'GET'
37                     }
38                 })
39             },
40             getEnvironmentDetail: function() {
41                 return $resource(Base_URL + '/api/v2/yardstick/openrcs/:openrc_id', { openrc_id: "@openrc_id" }, {
42                     'get': {
43                         method: 'GET'
44                     }
45                 })
46             },
47             addEnvName: function() {
48                 return $resource(Base_URL + '/api/v2/yardstick/environments', {}, {
49                     'post': {
50                         method: 'POST'
51                     }
52                 })
53             },
54             ItemDetail: function() {
55                 return $resource(Base_URL + '/api/v2/yardstick/environments/:envId', { envId: "@envId" }, {
56                     'get': {
57                         method: 'GET'
58                     }
59                 })
60             },
61             ImageDetail: function() {
62                 return $resource(Base_URL + '/api/v2/yardstick/images/:image_id', { image_id: "@image_id" }, {
63                     'get': {
64                         method: 'GET'
65                     }
66                 })
67             },
68             podDeatil: function() {
69                 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, {
70                     'get': {
71                         method: 'GET'
72                     }
73                 })
74             },
75             containerDetail: function() {
76                 return $resource(Base_URL + '/api/v2/yardstick/containers/:containerId', { containerId: "@containerId" }, {
77                     'get': {
78                         method: 'GET'
79                     }
80                 })
81             },
82             ImageList: function() {
83                 return $resource(Base_URL + '/api/v2/yardstick/images', {}, {
84                     'get': {
85                         method: 'GET'
86                     }
87                 })
88             },
89             uploadImage: function() {
90                 return $resource(Base_URL + '/api/v2/yardstick/images', {}, {
91                     'post': {
92                         method: 'POST'
93                     }
94                 })
95             },
96             getPodDetail: function() {
97                 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: "@podId" }, {
98                     'get': {
99                         method: 'GET'
100                     }
101                 })
102             },
103             runAcontainer: function() {
104                 return $resource(Base_URL + '/api/v2/yardstick/containers', { podId: "@podId" }, {
105                     'post': {
106                         method: 'POST'
107                     }
108                 })
109             },
110             getTestcaselist: function() {
111                 return $resource(Base_URL + '/api/v2/yardstick/testcases', {}, {
112                     'get': {
113                         method: 'GET'
114                     }
115                 })
116             },
117             getTestcaseDetail: function() {
118                 return $resource(Base_URL + '/api/v2/yardstick/testcases/:testcasename', { testcasename: "@testcasename" }, {
119                     'get': {
120                         method: 'GET'
121                     }
122                 })
123             },
124             suiteList: function() {
125                 return $resource(Base_URL + '/api/v2/yardstick/testsuites', {}, {
126                     'get': {
127                         method: 'GET'
128                     }
129                 })
130             },
131             suiteDetail: function() {
132                 return $resource(Base_URL + '/api/v2/yardstick/testsuites/:suiteName', { suiteName: "@suiteName" }, {
133                     'get': {
134                         method: 'GET'
135                     }
136                 })
137             },
138             suiteCreate: function() {
139                 return $resource(Base_URL + '/api/v2/yardstick/testsuites', {}, {
140                     'post': {
141                         method: 'POST'
142                     }
143                 })
144             },
145             projectList: function() {
146                 return $resource(Base_URL + '/api/v2/yardstick/projects', {}, {
147                     'get': {
148                         method: 'GET'
149                     }
150                 })
151             },
152             createProjectName: function() {
153                 return $resource(Base_URL + '/api/v2/yardstick/projects', {}, {
154                     'post': {
155                         method: 'POST'
156                     }
157                 })
158             },
159             getProjectDetail: function() {
160                 return $resource(Base_URL + '/api/v2/yardstick/projects/:project_id', { project_id: "@project_id" }, {
161                     'post': {
162                         method: 'POST'
163                     }
164                 })
165             },
166             createTask: function() {
167                 return $resource(Base_URL + '/api/v2/yardstick/tasks', {}, {
168                     'post': {
169                         method: 'POST'
170                     }
171                 })
172             },
173             getTaskDetail: function() {
174                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
175                     'get': {
176                         method: 'GET'
177                     }
178                 })
179             },
180
181             getTaskLog: function(){
182                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId/log?index=:index', { taskId: "@taskId", index: "@index" }, {
183                     'get': {
184                         method: 'GET'
185                     }
186                 })
187             },
188
189             taskAddEnv: function() {
190                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
191                     'put': {
192                         method: 'PUT'
193                     }
194                 })
195             },
196             //delete operate
197             deleteEnv: function() {
198                 return $resource(Base_URL + '/api/v2/yardstick/environments/:env_id', { env_id: '@env_id' }, {
199                     'delete': {
200                         method: 'DELETE'
201                     }
202                 })
203             },
204             deleteOpenrc: function() {
205                 return $resource(Base_URL + '/api/v2/yardstick/openrcs/:openrc', { openrc: '@openrc' }, {
206                     'delete': {
207                         method: 'DELETE'
208                     }
209                 })
210             },
211             deletePod: function() {
212                 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: '@podId' }, {
213                     'delete': {
214                         method: 'DELETE'
215                     }
216                 })
217             },
218             deleteContainer: function() {
219                 return $resource(Base_URL + '/api/v2/yardstick/containers/:containerId', { containerId: '@containerId' }, {
220                     'delete': {
221                         method: 'DELETE'
222                     }
223                 })
224             },
225             deleteTestCase: function() {
226                 return $resource(Base_URL + '/api/v2/yardstick/testcases/:caseName', { caseName: '@caseName' }, {
227                     'delete': {
228                         method: 'DELETE'
229                     }
230                 })
231             },
232             deleteTestSuite: function() {
233                 return $resource(Base_URL + '/api/v2/yardstick/testsuites/:suite_name', { suite_name: '@suite_name' }, {
234                     'delete': {
235                         method: 'DELETE'
236                     }
237                 })
238             },
239             deleteProject: function() {
240                 return $resource(Base_URL + '/api/v2/yardstick/projects/:project_id', { project_id: '@project_id' }, {
241                     'delete': {
242                         method: 'DELETE'
243                     }
244                 })
245             },
246             deleteTask: function() {
247                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:task_id', { task_id: '@task_id' }, {
248                     'delete': {
249                         method: 'DELETE'
250                     }
251                 })
252             }
253
254         };
255     }]);