1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
4 | *
|
---|
5 | * This file is part of HeuristicLab.
|
---|
6 | *
|
---|
7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU General Public License as published by
|
---|
9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
10 | * (at your option) any later version.
|
---|
11 | *
|
---|
12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU General Public License
|
---|
18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
19 | */
|
---|
20 | #endregion
|
---|
21 |
|
---|
22 | using System;
|
---|
23 | using System.Collections.Generic;
|
---|
24 | using System.Net.Security;
|
---|
25 | using System.ServiceModel;
|
---|
26 | using HeuristicLab.Services.Hive.DataTransfer;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.Hive.ServiceContracts {
|
---|
29 |
|
---|
30 | [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
|
---|
31 | public interface IHiveService {
|
---|
32 | #region Task Methods
|
---|
33 | [OperationContract]
|
---|
34 | Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds);
|
---|
35 |
|
---|
36 | [OperationContract]
|
---|
37 | Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData);
|
---|
38 |
|
---|
39 | [OperationContract]
|
---|
40 | Task GetTask(Guid taskId);
|
---|
41 |
|
---|
42 | [OperationContract]
|
---|
43 | IEnumerable<Task> GetTasks();
|
---|
44 |
|
---|
45 | [OperationContract]
|
---|
46 | IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds);
|
---|
47 |
|
---|
48 | [OperationContract]
|
---|
49 | IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent);
|
---|
50 |
|
---|
51 | [OperationContract]
|
---|
52 | IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId);
|
---|
53 |
|
---|
54 | [OperationContract]
|
---|
55 | IEnumerable<LightweightTask> GetLightweightJobTasksWithoutStateLog(Guid jobId);
|
---|
56 |
|
---|
57 | [OperationContract]
|
---|
58 | TaskData GetTaskData(Guid taskId);
|
---|
59 |
|
---|
60 | [OperationContract]
|
---|
61 | void UpdateTask(Task taskDto);
|
---|
62 |
|
---|
63 | [OperationContract]
|
---|
64 | void UpdateTaskData(Task taskDto, TaskData taskDataDto);
|
---|
65 |
|
---|
66 | [OperationContract]
|
---|
67 | void DeleteTask(Guid taskId);
|
---|
68 |
|
---|
69 | [OperationContract]
|
---|
70 | void DeleteChildTasks(Guid parentTaskId);
|
---|
71 |
|
---|
72 | [OperationContract]
|
---|
73 | Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
74 | #endregion
|
---|
75 |
|
---|
76 | #region Task Control Methods
|
---|
77 | [OperationContract]
|
---|
78 | void StopTask(Guid taskId);
|
---|
79 |
|
---|
80 | [OperationContract]
|
---|
81 | void PauseTask(Guid taskId);
|
---|
82 |
|
---|
83 | [OperationContract]
|
---|
84 | void RestartTask(Guid taskId);
|
---|
85 | #endregion
|
---|
86 |
|
---|
87 | #region Job Methods
|
---|
88 | [OperationContract]
|
---|
89 | Job GetJob(Guid id);
|
---|
90 |
|
---|
91 | /// <summary>
|
---|
92 | /// Returns all task for the current user
|
---|
93 | /// </summary>
|
---|
94 | [OperationContract]
|
---|
95 | IEnumerable<Job> GetJobs();
|
---|
96 |
|
---|
97 | /// <summary>
|
---|
98 | /// Returns all task in the hive (only for admins)
|
---|
99 | /// </summary>
|
---|
100 | /// <returns></returns>
|
---|
101 | [OperationContract]
|
---|
102 | IEnumerable<Job> GetAllJobs();
|
---|
103 |
|
---|
104 | [OperationContract]
|
---|
105 | Guid AddJob(Job jobDto);
|
---|
106 |
|
---|
107 | [OperationContract]
|
---|
108 | void UpdateJob(Job jobDto);
|
---|
109 |
|
---|
110 | [OperationContract]
|
---|
111 | void DeleteJob(Guid JobId);
|
---|
112 | #endregion
|
---|
113 |
|
---|
114 | #region JobPermission Methods
|
---|
115 | [OperationContract]
|
---|
116 | void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission);
|
---|
117 |
|
---|
118 | [OperationContract]
|
---|
119 | void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
|
---|
120 |
|
---|
121 | [OperationContract]
|
---|
122 | IEnumerable<JobPermission> GetJobPermissions(Guid jobId);
|
---|
123 |
|
---|
124 | [OperationContract]
|
---|
125 | bool IsAllowedPrivileged(); // current user may execute privileged task
|
---|
126 | #endregion
|
---|
127 |
|
---|
128 | #region Login Methods
|
---|
129 | [OperationContract]
|
---|
130 | void Hello(Slave slave);
|
---|
131 |
|
---|
132 | [OperationContract]
|
---|
133 | void GoodBye(Guid slaveId);
|
---|
134 | #endregion
|
---|
135 |
|
---|
136 | #region Heartbeat Methods
|
---|
137 | [OperationContract]
|
---|
138 | List<MessageContainer> Heartbeat(Heartbeat heartbeat);
|
---|
139 | #endregion
|
---|
140 |
|
---|
141 | #region Plugin Methods
|
---|
142 | [OperationContract]
|
---|
143 | Plugin GetPlugin(Guid pluginId);
|
---|
144 |
|
---|
145 | [OperationContract]
|
---|
146 | Plugin GetPluginByHash(byte[] hash);
|
---|
147 |
|
---|
148 | [OperationContract]
|
---|
149 | [FaultContract(typeof(PluginAlreadyExistsFault))]
|
---|
150 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
151 |
|
---|
152 | [OperationContract]
|
---|
153 | IEnumerable<Plugin> GetPlugins();
|
---|
154 |
|
---|
155 | [OperationContract]
|
---|
156 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
157 |
|
---|
158 | [OperationContract]
|
---|
159 | void DeletePlugin(Guid pluginId);
|
---|
160 | #endregion
|
---|
161 |
|
---|
162 | #region ResourcePermission Methods
|
---|
163 | [OperationContract]
|
---|
164 | void GrantResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
165 |
|
---|
166 | [OperationContract]
|
---|
167 | void RevokeResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
168 |
|
---|
169 | [OperationContract]
|
---|
170 | IEnumerable<ResourcePermission> GetResourcePermissions(Guid resourceId);
|
---|
171 | #endregion
|
---|
172 |
|
---|
173 | #region Resource Methods
|
---|
174 | [OperationContract]
|
---|
175 | IEnumerable<Resource> GetChildResources(Guid resourceId);
|
---|
176 | #endregion
|
---|
177 |
|
---|
178 | #region Slave Methods
|
---|
179 | [OperationContract]
|
---|
180 | Guid AddSlave(Slave slave);
|
---|
181 |
|
---|
182 | [OperationContract]
|
---|
183 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
184 |
|
---|
185 | [OperationContract]
|
---|
186 | Slave GetSlave(Guid slaveId);
|
---|
187 |
|
---|
188 | [OperationContract]
|
---|
189 | SlaveGroup GetSlaveGroup(Guid slaveGroupId);
|
---|
190 |
|
---|
191 | [OperationContract]
|
---|
192 | IEnumerable<Slave> GetSlaves();
|
---|
193 |
|
---|
194 | [OperationContract]
|
---|
195 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
196 |
|
---|
197 | [OperationContract]
|
---|
198 | void UpdateSlave(Slave slave);
|
---|
199 |
|
---|
200 | [OperationContract]
|
---|
201 | void UpdateSlaveGroup(SlaveGroup slaveGroup);
|
---|
202 |
|
---|
203 | [OperationContract]
|
---|
204 | void DeleteSlave(Guid slaveId);
|
---|
205 |
|
---|
206 | [OperationContract]
|
---|
207 | void DeleteSlaveGroup(Guid slaveGroupId);
|
---|
208 |
|
---|
209 | [OperationContract]
|
---|
210 | void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
|
---|
211 |
|
---|
212 | [OperationContract]
|
---|
213 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
214 |
|
---|
215 | [OperationContract]
|
---|
216 | Guid GetResourceId(string resourceName);
|
---|
217 |
|
---|
218 | [OperationContract]
|
---|
219 | IEnumerable<Task> GetTasksByResourceId(Guid resourceId);
|
---|
220 |
|
---|
221 | [OperationContract]
|
---|
222 | void TriggerEventManager(bool force);
|
---|
223 |
|
---|
224 | [OperationContract]
|
---|
225 | int GetNewHeartbeatInterval(Guid slaveId);
|
---|
226 | #endregion
|
---|
227 |
|
---|
228 | #region Downtime Methods
|
---|
229 | [OperationContract]
|
---|
230 | Guid AddDowntime(Downtime downtime);
|
---|
231 |
|
---|
232 | [OperationContract]
|
---|
233 | void DeleteDowntime(Guid downtimeId);
|
---|
234 |
|
---|
235 | [OperationContract]
|
---|
236 | void UpdateDowntime(Downtime downtime);
|
---|
237 |
|
---|
238 | [OperationContract]
|
---|
239 | IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
|
---|
240 | #endregion
|
---|
241 |
|
---|
242 | #region User Methods
|
---|
243 | [OperationContract]
|
---|
244 | string GetUsernameByUserId(Guid userId);
|
---|
245 |
|
---|
246 | [OperationContract]
|
---|
247 | Guid GetUserIdByUsername(string username);
|
---|
248 | #endregion
|
---|
249 |
|
---|
250 | #region UserPriorities Methods
|
---|
251 | [OperationContract]
|
---|
252 | IEnumerable<UserPriority> GetUserPriorities();
|
---|
253 | #endregion
|
---|
254 |
|
---|
255 | #region Statistics Methods
|
---|
256 | [OperationContract]
|
---|
257 | IEnumerable<Statistics> GetStatistics();
|
---|
258 | [OperationContract]
|
---|
259 | IEnumerable<Statistics> GetStatisticsForTimePeriod(DateTime from, DateTime to);
|
---|
260 | #endregion
|
---|
261 | }
|
---|
262 | }
|
---|