[6983] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[7259] | 3 | * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[6983] | 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 |
|
---|
| 33 | #region Task Methods
|
---|
| 34 | [OperationContract]
|
---|
| 35 | Guid AddTask(Task task, TaskData taskData, IEnumerable<Guid> resourceIds);
|
---|
| 36 |
|
---|
| 37 | [OperationContract]
|
---|
| 38 | Guid AddChildTask(Guid parentTaskId, Task task, TaskData taskData);
|
---|
| 39 |
|
---|
| 40 | [OperationContract]
|
---|
| 41 | Task GetTask(Guid taskId);
|
---|
| 42 |
|
---|
| 43 | [OperationContract]
|
---|
| 44 | IEnumerable<Task> GetTasks();
|
---|
| 45 |
|
---|
| 46 | [OperationContract]
|
---|
| 47 | IEnumerable<LightweightTask> GetLightweightTasks(IEnumerable<Guid> taskIds);
|
---|
| 48 |
|
---|
| 49 | [OperationContract]
|
---|
| 50 | IEnumerable<LightweightTask> GetLightweightChildTasks(Guid? parentTaskId, bool recursive, bool includeParent);
|
---|
| 51 |
|
---|
| 52 | [OperationContract]
|
---|
| 53 | IEnumerable<LightweightTask> GetLightweightJobTasks(Guid jobId);
|
---|
| 54 |
|
---|
| 55 | [OperationContract]
|
---|
| 56 | TaskData GetTaskData(Guid taskId);
|
---|
| 57 |
|
---|
| 58 | [OperationContract]
|
---|
| 59 | void UpdateTask(Task taskDto);
|
---|
| 60 |
|
---|
| 61 | [OperationContract]
|
---|
| 62 | void UpdateTaskData(Task taskDto, TaskData taskDataDto);
|
---|
| 63 |
|
---|
| 64 | [OperationContract]
|
---|
| 65 | void DeleteTask(Guid taskId);
|
---|
| 66 |
|
---|
| 67 | [OperationContract]
|
---|
| 68 | void DeleteChildTasks(Guid parentTaskId);
|
---|
| 69 |
|
---|
| 70 | [OperationContract]
|
---|
| 71 | Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
| 72 | #endregion
|
---|
| 73 |
|
---|
| 74 | #region Task Control Methods
|
---|
| 75 | [OperationContract]
|
---|
| 76 | void StopTask(Guid taskId);
|
---|
| 77 |
|
---|
| 78 | [OperationContract]
|
---|
| 79 | void PauseTask(Guid taskId);
|
---|
| 80 |
|
---|
| 81 | [OperationContract]
|
---|
| 82 | void RestartTask(Guid taskId);
|
---|
| 83 | #endregion
|
---|
| 84 |
|
---|
| 85 | #region Job Methods
|
---|
| 86 | [OperationContract]
|
---|
| 87 | Job GetJob(Guid id);
|
---|
| 88 |
|
---|
| 89 | /// <summary>
|
---|
| 90 | /// Returns all task for the current user
|
---|
| 91 | /// </summary>
|
---|
| 92 | [OperationContract]
|
---|
| 93 | IEnumerable<Job> GetJobs();
|
---|
| 94 |
|
---|
| 95 | /// <summary>
|
---|
| 96 | /// Returns all task in the hive (only for admins)
|
---|
| 97 | /// </summary>
|
---|
| 98 | /// <returns></returns>
|
---|
| 99 | [OperationContract]
|
---|
| 100 | IEnumerable<Job> GetAllJobs();
|
---|
| 101 |
|
---|
| 102 | [OperationContract]
|
---|
| 103 | Guid AddJob(Job jobDto);
|
---|
| 104 |
|
---|
| 105 | [OperationContract]
|
---|
| 106 | void UpdateJob(Job jobDto);
|
---|
| 107 |
|
---|
| 108 | [OperationContract]
|
---|
| 109 | void DeleteJob(Guid JobId);
|
---|
| 110 | #endregion
|
---|
| 111 |
|
---|
| 112 | #region JobPermission Methods
|
---|
| 113 | [OperationContract]
|
---|
| 114 | void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission);
|
---|
| 115 |
|
---|
| 116 | [OperationContract]
|
---|
| 117 | void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
|
---|
| 118 |
|
---|
| 119 | [OperationContract]
|
---|
| 120 | IEnumerable<JobPermission> GetJobPermissions(Guid jobId);
|
---|
| 121 |
|
---|
| 122 | [OperationContract]
|
---|
| 123 | bool IsAllowedPrivileged(); // current user may execute privileged task
|
---|
| 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 |
|
---|
| 143 | [OperationContract]
|
---|
| 144 | Plugin GetPluginByHash(byte[] hash);
|
---|
| 145 |
|
---|
| 146 | [OperationContract]
|
---|
| 147 | [FaultContract(typeof(PluginAlreadyExistsFault))]
|
---|
| 148 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
| 149 |
|
---|
| 150 | [OperationContract]
|
---|
| 151 | IEnumerable<Plugin> GetPlugins();
|
---|
| 152 |
|
---|
| 153 | [OperationContract]
|
---|
| 154 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
| 155 |
|
---|
| 156 | [OperationContract]
|
---|
| 157 | void DeletePlugin(Guid pluginId);
|
---|
| 158 | #endregion
|
---|
| 159 |
|
---|
| 160 | #region Slave Methods
|
---|
| 161 | [OperationContract]
|
---|
| 162 | Guid AddSlave(Slave slave);
|
---|
| 163 |
|
---|
| 164 | [OperationContract]
|
---|
| 165 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
| 166 |
|
---|
| 167 | [OperationContract]
|
---|
| 168 | Slave GetSlave(Guid slaveId);
|
---|
| 169 |
|
---|
| 170 | [OperationContract]
|
---|
| 171 | SlaveGroup GetSlaveGroup(Guid slaveGroupId);
|
---|
| 172 |
|
---|
| 173 | [OperationContract]
|
---|
| 174 | IEnumerable<Slave> GetSlaves();
|
---|
| 175 |
|
---|
| 176 | [OperationContract]
|
---|
| 177 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
| 178 |
|
---|
| 179 | [OperationContract]
|
---|
| 180 | void UpdateSlave(Slave slave);
|
---|
| 181 |
|
---|
| 182 | [OperationContract]
|
---|
| 183 | void UpdateSlaveGroup(SlaveGroup slaveGroup);
|
---|
| 184 |
|
---|
| 185 | [OperationContract]
|
---|
| 186 | void DeleteSlave(Guid slaveId);
|
---|
| 187 |
|
---|
| 188 | [OperationContract]
|
---|
| 189 | void DeleteSlaveGroup(Guid slaveGroupId);
|
---|
| 190 |
|
---|
| 191 | [OperationContract]
|
---|
| 192 | void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
|
---|
| 193 |
|
---|
| 194 | [OperationContract]
|
---|
| 195 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
| 196 |
|
---|
| 197 | [OperationContract]
|
---|
| 198 | Guid GetResourceId(string resourceName);
|
---|
| 199 |
|
---|
| 200 | [OperationContract]
|
---|
| 201 | IEnumerable<Task> GetTasksByResourceId(Guid resourceId);
|
---|
| 202 |
|
---|
| 203 | [OperationContract]
|
---|
| 204 | void TriggerEventManager(bool force);
|
---|
| 205 |
|
---|
| 206 | [OperationContract]
|
---|
| 207 | int GetNewHeartbeatInterval(Guid slaveId);
|
---|
| 208 | #endregion
|
---|
| 209 |
|
---|
| 210 | #region Downtime Methods
|
---|
| 211 | [OperationContract]
|
---|
| 212 | Guid AddDowntime(Downtime downtime);
|
---|
| 213 |
|
---|
| 214 | [OperationContract]
|
---|
| 215 | void DeleteDowntime(Guid downtimeId);
|
---|
| 216 |
|
---|
| 217 | [OperationContract]
|
---|
| 218 | void UpdateDowntime(Downtime downtime);
|
---|
| 219 |
|
---|
| 220 | [OperationContract]
|
---|
| 221 | IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
|
---|
| 222 | #endregion
|
---|
| 223 |
|
---|
| 224 | #region User Methods
|
---|
| 225 | [OperationContract]
|
---|
| 226 | string GetUsernameByUserId(Guid userId);
|
---|
| 227 |
|
---|
| 228 | [OperationContract]
|
---|
| 229 | Guid GetUserIdByUsername(string username);
|
---|
| 230 | #endregion
|
---|
| 231 | }
|
---|
| 232 | }
|
---|