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             taskAddEnv: function() {
182                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:taskId', { taskId: "@taskId" }, {
183                     'put': {
184                         method: 'PUT'
185                     }
186                 })
187             },
188             //delete operate
189             deleteEnv: function() {
190                 return $resource(Base_URL + '/api/v2/yardstick/environments/:env_id', { env_id: '@env_id' }, {
191                     'delete': {
192                         method: 'DELETE'
193                     }
194                 })
195             },
196             deleteOpenrc: function() {
197                 return $resource(Base_URL + '/api/v2/yardstick/openrcs/:openrc', { openrc: '@openrc' }, {
198                     'delete': {
199                         method: 'DELETE'
200                     }
201                 })
202             },
203             deletePod: function() {
204                 return $resource(Base_URL + '/api/v2/yardstick/pods/:podId', { podId: '@podId' }, {
205                     'delete': {
206                         method: 'DELETE'
207                     }
208                 })
209             },
210             deleteContainer: function() {
211                 return $resource(Base_URL + '/api/v2/yardstick/containers/:containerId', { containerId: '@containerId' }, {
212                     'delete': {
213                         method: 'DELETE'
214                     }
215                 })
216             },
217             deleteTestCase: function() {
218                 return $resource(Base_URL + '/api/v2/yardstick/testcases/:caseName', { caseName: '@caseName' }, {
219                     'delete': {
220                         method: 'DELETE'
221                     }
222                 })
223             },
224             deleteTestSuite: function() {
225                 return $resource(Base_URL + '/api/v2/yardstick/testsuites/:suite_name', { suite_name: '@suite_name' }, {
226                     'delete': {
227                         method: 'DELETE'
228                     }
229                 })
230             },
231             deleteProject: function() {
232                 return $resource(Base_URL + '/api/v2/yardstick/projects/:project_id', { project_id: '@project_id' }, {
233                     'delete': {
234                         method: 'DELETE'
235                     }
236                 })
237             },
238             deleteTask: function() {
239                 return $resource(Base_URL + '/api/v2/yardstick/tasks/:task_id', { task_id: '@task_id' }, {
240                     'delete': {
241                         method: 'DELETE'
242                     }
243                 })
244             }
245
246         };
247     }]);