1 | #region License Information
|
---|
2 | /* HeuristicLab
|
---|
3 | * Copyright (C) 2002-2011 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.Common.DataTransfer;
|
---|
27 |
|
---|
28 | namespace HeuristicLab.Services.Hive.Common.ServiceContracts {
|
---|
29 |
|
---|
30 | [ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
|
---|
31 | public interface IHiveService {
|
---|
32 |
|
---|
33 | #region Job Methods
|
---|
34 | [OperationContract]
|
---|
35 | Guid AddJob(Job job, JobData jobData, IEnumerable<Guid> resourceIds);
|
---|
36 |
|
---|
37 | [OperationContract]
|
---|
38 | Guid AddChildJob(Guid parentJobId, Job job, JobData jobData);
|
---|
39 |
|
---|
40 | [OperationContract]
|
---|
41 | Job GetJob(Guid jobId);
|
---|
42 |
|
---|
43 | [OperationContract]
|
---|
44 | IEnumerable<Job> GetJobs();
|
---|
45 |
|
---|
46 | [OperationContract]
|
---|
47 | IEnumerable<LightweightJob> GetLightweightJobs(IEnumerable<Guid> jobIds);
|
---|
48 |
|
---|
49 | [OperationContract]
|
---|
50 | IEnumerable<LightweightJob> GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent);
|
---|
51 |
|
---|
52 | [OperationContract]
|
---|
53 | IEnumerable<LightweightJob> GetLightweightExperimentJobs(Guid experimentId);
|
---|
54 |
|
---|
55 | [OperationContract]
|
---|
56 | JobData GetJobData(Guid jobId);
|
---|
57 |
|
---|
58 | [OperationContract]
|
---|
59 | void UpdateJob(Job jobDto);
|
---|
60 |
|
---|
61 | [OperationContract]
|
---|
62 | void UpdateJobData(Job jobDto, JobData jobDataDto);
|
---|
63 |
|
---|
64 | [OperationContract]
|
---|
65 | void DeleteJob(Guid jobId);
|
---|
66 |
|
---|
67 | [OperationContract]
|
---|
68 | void DeleteChildJobs(Guid parentJobId);
|
---|
69 |
|
---|
70 | [OperationContract]
|
---|
71 | Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception);
|
---|
72 | #endregion
|
---|
73 |
|
---|
74 | #region Job Control Methods
|
---|
75 | [OperationContract]
|
---|
76 | void StopJob(Guid jobId);
|
---|
77 |
|
---|
78 | [OperationContract]
|
---|
79 | void PauseJob(Guid jobId);
|
---|
80 |
|
---|
81 | [OperationContract]
|
---|
82 | void RestartJob(Guid jobId);
|
---|
83 | #endregion
|
---|
84 |
|
---|
85 | #region HiveExperiment Methods
|
---|
86 | [OperationContract]
|
---|
87 | HiveExperiment GetHiveExperiment(Guid id);
|
---|
88 |
|
---|
89 | /// <summary>
|
---|
90 | /// Returns all experiments for the current user
|
---|
91 | /// </summary>
|
---|
92 | [OperationContract]
|
---|
93 | IEnumerable<HiveExperiment> GetHiveExperiments();
|
---|
94 |
|
---|
95 | /// <summary>
|
---|
96 | /// Returns all experiments in the hive (only for admins)
|
---|
97 | /// </summary>
|
---|
98 | /// <returns></returns>
|
---|
99 | [OperationContract]
|
---|
100 | IEnumerable<HiveExperiment> GetAllHiveExperiments();
|
---|
101 |
|
---|
102 | [OperationContract]
|
---|
103 | Guid AddHiveExperiment(HiveExperiment hiveExperimentDto);
|
---|
104 |
|
---|
105 | [OperationContract]
|
---|
106 | void UpdateHiveExperiment(HiveExperiment hiveExperimentDto);
|
---|
107 |
|
---|
108 | [OperationContract]
|
---|
109 | void DeleteHiveExperiment(Guid hiveExperimentId);
|
---|
110 | #endregion
|
---|
111 |
|
---|
112 | #region HiveExperimentPermission Methods
|
---|
113 | [OperationContract]
|
---|
114 | void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission);
|
---|
115 |
|
---|
116 | [OperationContract]
|
---|
117 | void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
|
---|
118 |
|
---|
119 | [OperationContract]
|
---|
120 | IEnumerable<HiveExperimentPermission> GetHiveExperimentPermissions(Guid hiveExperimentId);
|
---|
121 |
|
---|
122 | [OperationContract]
|
---|
123 | bool IsAllowedPrivileged(); // current user may execute privileged jobs
|
---|
124 | #endregion
|
---|
125 |
|
---|
126 | #region Login Methods
|
---|
127 | [OperationContract]
|
---|
128 | void Hello(Slave slave);
|
---|
129 |
|
---|
130 | [OperationContract]
|
---|
131 | void GoodBye(Guid slaveId);
|
---|
132 | #endregion
|
---|
133 |
|
---|
134 | #region Heartbeat Methods
|
---|
135 | [OperationContract]
|
---|
136 | List<MessageContainer> Heartbeat(Heartbeat heartbeat);
|
---|
137 | #endregion
|
---|
138 |
|
---|
139 | #region Plugin Methods
|
---|
140 | [OperationContract]
|
---|
141 | Plugin GetPlugin(Guid pluginId);
|
---|
142 | [OperationContract]
|
---|
143 | Plugin GetPluginByHash(byte[] hash);
|
---|
144 | [OperationContract]
|
---|
145 | [FaultContract(typeof(PluginAlreadyExistsFault))]
|
---|
146 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
147 | [OperationContract]
|
---|
148 | IEnumerable<Plugin> GetPlugins();
|
---|
149 | [OperationContract]
|
---|
150 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
151 | [OperationContract]
|
---|
152 | void DeletePlugin(Guid pluginId);
|
---|
153 | #endregion
|
---|
154 |
|
---|
155 | #region Slave Methods
|
---|
156 | [OperationContract]
|
---|
157 | Guid AddSlave(Slave slave);
|
---|
158 |
|
---|
159 | [OperationContract]
|
---|
160 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
161 |
|
---|
162 | [OperationContract]
|
---|
163 | Slave GetSlave(Guid slaveId);
|
---|
164 |
|
---|
165 | [OperationContract]
|
---|
166 | SlaveGroup GetSlaveGroup(Guid slaveGroupId);
|
---|
167 |
|
---|
168 | [OperationContract]
|
---|
169 | IEnumerable<Slave> GetSlaves();
|
---|
170 |
|
---|
171 | [OperationContract]
|
---|
172 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
173 |
|
---|
174 | [OperationContract]
|
---|
175 | void UpdateSlave(Slave slave);
|
---|
176 |
|
---|
177 | [OperationContract]
|
---|
178 | void UpdateSlaveGroup(SlaveGroup slaveGroup);
|
---|
179 |
|
---|
180 | [OperationContract]
|
---|
181 | void DeleteSlave(Guid slaveId);
|
---|
182 |
|
---|
183 | [OperationContract]
|
---|
184 | void DeleteSlaveGroup(Guid slaveGroupId);
|
---|
185 |
|
---|
186 | [OperationContract]
|
---|
187 | void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
|
---|
188 |
|
---|
189 | [OperationContract]
|
---|
190 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
191 |
|
---|
192 | [OperationContract]
|
---|
193 | Guid GetResourceId(string resourceName);
|
---|
194 |
|
---|
195 | [OperationContract]
|
---|
196 | IEnumerable<Job> GetJobsByResourceId(Guid resourceId);
|
---|
197 |
|
---|
198 | [OperationContract]
|
---|
199 | void TriggerEventManager(bool force);
|
---|
200 | #endregion
|
---|
201 |
|
---|
202 | #region Downtime Methods
|
---|
203 | [OperationContract]
|
---|
204 | Guid AddDowntime(Downtime downtime);
|
---|
205 |
|
---|
206 | [OperationContract]
|
---|
207 | void DeleteDowntime(Guid downtimeId);
|
---|
208 |
|
---|
209 | [OperationContract]
|
---|
210 | void UpdateDowntime(Downtime downtime);
|
---|
211 |
|
---|
212 | [OperationContract]
|
---|
213 | IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
|
---|
214 | #endregion
|
---|
215 |
|
---|
216 | #region User Methods
|
---|
217 | [OperationContract]
|
---|
218 | string GetUsernameByUserId(Guid userId);
|
---|
219 |
|
---|
220 | [OperationContract]
|
---|
221 | Guid GetUserIdByUsername(string username);
|
---|
222 | #endregion
|
---|
223 | }
|
---|
224 | }
|
---|