[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 | #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 | TaskData GetTaskData(Guid taskId);
|
---|
| 56 |
|
---|
| 57 | [OperationContract]
|
---|
| 58 | void UpdateTask(Task taskDto);
|
---|
| 59 |
|
---|
| 60 | [OperationContract]
|
---|
| 61 | void UpdateTaskData(Task taskDto, TaskData taskDataDto);
|
---|
| 62 |
|
---|
| 63 | [OperationContract]
|
---|
| 64 | void DeleteTask(Guid taskId);
|
---|
| 65 |
|
---|
| 66 | [OperationContract]
|
---|
| 67 | void DeleteChildTasks(Guid parentTaskId);
|
---|
| 68 |
|
---|
| 69 | [OperationContract]
|
---|
| 70 | Task UpdateTaskState(Guid taskId, TaskState taskState, Guid? slaveId, Guid? userId, string exception);
|
---|
| 71 | #endregion
|
---|
| 72 |
|
---|
| 73 | #region Task Control Methods
|
---|
| 74 | [OperationContract]
|
---|
| 75 | void StopTask(Guid taskId);
|
---|
| 76 |
|
---|
| 77 | [OperationContract]
|
---|
| 78 | void PauseTask(Guid taskId);
|
---|
| 79 |
|
---|
| 80 | [OperationContract]
|
---|
| 81 | void RestartTask(Guid taskId);
|
---|
| 82 | #endregion
|
---|
| 83 |
|
---|
| 84 | #region Job Methods
|
---|
| 85 | [OperationContract]
|
---|
| 86 | Job GetJob(Guid id);
|
---|
| 87 |
|
---|
| 88 | /// <summary>
|
---|
| 89 | /// Returns all task for the current user
|
---|
| 90 | /// </summary>
|
---|
| 91 | [OperationContract]
|
---|
| 92 | IEnumerable<Job> GetJobs();
|
---|
| 93 |
|
---|
| 94 | /// <summary>
|
---|
| 95 | /// Returns all task in the hive (only for admins)
|
---|
| 96 | /// </summary>
|
---|
| 97 | /// <returns></returns>
|
---|
| 98 | [OperationContract]
|
---|
| 99 | IEnumerable<Job> GetAllJobs();
|
---|
| 100 |
|
---|
| 101 | [OperationContract]
|
---|
| 102 | Guid AddJob(Job jobDto);
|
---|
| 103 |
|
---|
| 104 | [OperationContract]
|
---|
| 105 | void UpdateJob(Job jobDto);
|
---|
| 106 |
|
---|
| 107 | [OperationContract]
|
---|
| 108 | void DeleteJob(Guid JobId);
|
---|
| 109 | #endregion
|
---|
| 110 |
|
---|
| 111 | #region JobPermission Methods
|
---|
| 112 | [OperationContract]
|
---|
| 113 | void GrantPermission(Guid jobId, Guid grantedUserId, Permission permission);
|
---|
| 114 |
|
---|
| 115 | [OperationContract]
|
---|
| 116 | void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
|
---|
| 117 |
|
---|
| 118 | [OperationContract]
|
---|
| 119 | IEnumerable<JobPermission> GetJobPermissions(Guid jobId);
|
---|
| 120 |
|
---|
| 121 | [OperationContract]
|
---|
| 122 | bool IsAllowedPrivileged(); // current user may execute privileged task
|
---|
| 123 | #endregion
|
---|
| 124 |
|
---|
| 125 | #region Login Methods
|
---|
| 126 | [OperationContract]
|
---|
| 127 | void Hello(Slave slave);
|
---|
| 128 |
|
---|
| 129 | [OperationContract]
|
---|
| 130 | void GoodBye(Guid slaveId);
|
---|
| 131 | #endregion
|
---|
| 132 |
|
---|
| 133 | #region Heartbeat Methods
|
---|
| 134 | [OperationContract]
|
---|
| 135 | List<MessageContainer> Heartbeat(Heartbeat heartbeat);
|
---|
| 136 | #endregion
|
---|
| 137 |
|
---|
| 138 | #region Plugin Methods
|
---|
| 139 | [OperationContract]
|
---|
| 140 | Plugin GetPlugin(Guid pluginId);
|
---|
| 141 |
|
---|
| 142 | [OperationContract]
|
---|
| 143 | Plugin GetPluginByHash(byte[] hash);
|
---|
| 144 |
|
---|
| 145 | [OperationContract]
|
---|
| 146 | [FaultContract(typeof(PluginAlreadyExistsFault))]
|
---|
| 147 | Guid AddPlugin(Plugin plugin, List<PluginData> pluginData);
|
---|
| 148 |
|
---|
| 149 | [OperationContract]
|
---|
| 150 | IEnumerable<Plugin> GetPlugins();
|
---|
| 151 |
|
---|
| 152 | [OperationContract]
|
---|
| 153 | IEnumerable<PluginData> GetPluginDatas(List<Guid> pluginIds);
|
---|
| 154 |
|
---|
| 155 | [OperationContract]
|
---|
| 156 | void DeletePlugin(Guid pluginId);
|
---|
| 157 | #endregion
|
---|
| 158 |
|
---|
[7916] | 159 | #region ResourcePermission Methods
|
---|
| 160 | [OperationContract]
|
---|
[8065] | 161 | void GrantResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
[7916] | 162 |
|
---|
| 163 | [OperationContract]
|
---|
[8065] | 164 | void RevokeResourcePermissions(Guid resourceId, Guid[] grantedUserIds);
|
---|
[7916] | 165 |
|
---|
| 166 | [OperationContract]
|
---|
| 167 | IEnumerable<ResourcePermission> GetResourcePermissions(Guid resourceId);
|
---|
| 168 | #endregion
|
---|
| 169 |
|
---|
[6983] | 170 | #region Slave Methods
|
---|
| 171 | [OperationContract]
|
---|
| 172 | Guid AddSlave(Slave slave);
|
---|
| 173 |
|
---|
| 174 | [OperationContract]
|
---|
| 175 | Guid AddSlaveGroup(SlaveGroup slaveGroup);
|
---|
| 176 |
|
---|
| 177 | [OperationContract]
|
---|
| 178 | Slave GetSlave(Guid slaveId);
|
---|
| 179 |
|
---|
| 180 | [OperationContract]
|
---|
| 181 | SlaveGroup GetSlaveGroup(Guid slaveGroupId);
|
---|
| 182 |
|
---|
| 183 | [OperationContract]
|
---|
| 184 | IEnumerable<Slave> GetSlaves();
|
---|
| 185 |
|
---|
| 186 | [OperationContract]
|
---|
| 187 | IEnumerable<SlaveGroup> GetSlaveGroups();
|
---|
| 188 |
|
---|
| 189 | [OperationContract]
|
---|
| 190 | void UpdateSlave(Slave slave);
|
---|
| 191 |
|
---|
| 192 | [OperationContract]
|
---|
| 193 | void UpdateSlaveGroup(SlaveGroup slaveGroup);
|
---|
| 194 |
|
---|
| 195 | [OperationContract]
|
---|
| 196 | void DeleteSlave(Guid slaveId);
|
---|
| 197 |
|
---|
| 198 | [OperationContract]
|
---|
| 199 | void DeleteSlaveGroup(Guid slaveGroupId);
|
---|
| 200 |
|
---|
| 201 | [OperationContract]
|
---|
| 202 | void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
|
---|
| 203 |
|
---|
| 204 | [OperationContract]
|
---|
| 205 | void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
|
---|
| 206 |
|
---|
| 207 | [OperationContract]
|
---|
| 208 | Guid GetResourceId(string resourceName);
|
---|
| 209 |
|
---|
| 210 | [OperationContract]
|
---|
| 211 | IEnumerable<Task> GetTasksByResourceId(Guid resourceId);
|
---|
| 212 |
|
---|
| 213 | [OperationContract]
|
---|
| 214 | void TriggerEventManager(bool force);
|
---|
| 215 |
|
---|
| 216 | [OperationContract]
|
---|
| 217 | int GetNewHeartbeatInterval(Guid slaveId);
|
---|
| 218 | #endregion
|
---|
| 219 |
|
---|
| 220 | #region Downtime Methods
|
---|
| 221 | [OperationContract]
|
---|
| 222 | Guid AddDowntime(Downtime downtime);
|
---|
| 223 |
|
---|
| 224 | [OperationContract]
|
---|
| 225 | void DeleteDowntime(Guid downtimeId);
|
---|
| 226 |
|
---|
| 227 | [OperationContract]
|
---|
| 228 | void UpdateDowntime(Downtime downtime);
|
---|
| 229 |
|
---|
| 230 | [OperationContract]
|
---|
| 231 | IEnumerable<Downtime> GetDowntimesForResource(Guid resourceId);
|
---|
| 232 | #endregion
|
---|
| 233 |
|
---|
| 234 | #region User Methods
|
---|
| 235 | [OperationContract]
|
---|
| 236 | string GetUsernameByUserId(Guid userId);
|
---|
| 237 |
|
---|
| 238 | [OperationContract]
|
---|
| 239 | Guid GetUserIdByUsername(string username);
|
---|
| 240 | #endregion
|
---|
| 241 | }
|
---|
| 242 | }
|
---|