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