#region License Information
/* HeuristicLab
* Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Net.Security;
using System.ServiceModel;
using HeuristicLab.Services.Hive.Common.DataTransfer;
namespace HeuristicLab.Services.Hive.Common.ServiceContracts {
[ServiceContract(ProtectionLevel = ProtectionLevel.EncryptAndSign)]
public interface IHiveService {
#region Job Methods
[OperationContract]
Guid AddJob(Job job, JobData jobData, IEnumerable resourceIds);
[OperationContract]
Guid AddChildJob(Guid parentJobId, Job job, JobData jobData);
[OperationContract]
Job GetJob(Guid jobId);
[OperationContract]
IEnumerable GetJobs();
[OperationContract]
IEnumerable GetLightweightJobs(IEnumerable jobIds);
[OperationContract]
IEnumerable GetLightweightChildJobs(Guid? parentJobId, bool recursive, bool includeParent);
[OperationContract]
IEnumerable GetLightweightExperimentJobs(Guid experimentId);
[OperationContract]
JobData GetJobData(Guid jobId);
[OperationContract]
void UpdateJob(Job jobDto);
[OperationContract]
void UpdateJobData(Job jobDto, JobData jobDataDto);
[OperationContract]
void DeleteJob(Guid jobId);
[OperationContract]
void DeleteChildJobs(Guid parentJobId);
[OperationContract]
Job UpdateJobState(Guid jobId, JobState jobState, Guid? slaveId, Guid? userId, string exception);
#endregion
#region Job Control Methods
[OperationContract]
void StopJob(Guid jobId);
[OperationContract]
void PauseJob(Guid jobId);
[OperationContract]
void RestartJob(Guid jobId);
#endregion
#region HiveExperiment Methods
[OperationContract]
HiveExperiment GetHiveExperiment(Guid id);
///
/// Returns all experiments for the current user
///
[OperationContract]
IEnumerable GetHiveExperiments();
///
/// Returns all experiments in the hive (only for admins)
///
///
[OperationContract]
IEnumerable GetAllHiveExperiments();
[OperationContract]
Guid AddHiveExperiment(HiveExperiment hiveExperimentDto);
[OperationContract]
void UpdateHiveExperiment(HiveExperiment hiveExperimentDto);
[OperationContract]
void DeleteHiveExperiment(Guid hiveExperimentId);
#endregion
#region HiveExperimentPermission Methods
[OperationContract]
void GrantPermission(Guid hiveExperimentId, Guid grantedUserId, Permission permission);
[OperationContract]
void RevokePermission(Guid hiveExperimentId, Guid grantedUserId);
[OperationContract]
IEnumerable GetHiveExperimentPermissions(Guid hiveExperimentId);
[OperationContract]
bool IsAllowedPrivileged(); // current user may execute privileged jobs
#endregion
#region Login Methods
[OperationContract]
void Hello(Slave slave);
[OperationContract]
void GoodBye(Guid slaveId);
#endregion
#region Heartbeat Methods
[OperationContract]
List Heartbeat(Heartbeat heartbeat);
#endregion
#region Plugin Methods
[OperationContract]
Plugin GetPlugin(Guid pluginId);
[OperationContract]
Plugin GetPluginByHash(byte[] hash);
[OperationContract]
[FaultContract(typeof(PluginAlreadyExistsFault))]
Guid AddPlugin(Plugin plugin, List pluginData);
[OperationContract]
IEnumerable GetPlugins();
[OperationContract]
IEnumerable GetPluginDatas(List pluginIds);
[OperationContract]
void DeletePlugin(Guid pluginId);
#endregion
#region Slave Methods
[OperationContract]
Guid AddSlave(Slave slave);
[OperationContract]
Guid AddSlaveGroup(SlaveGroup slaveGroup);
[OperationContract]
Slave GetSlave(Guid slaveId);
[OperationContract]
SlaveGroup GetSlaveGroup(Guid slaveGroupId);
[OperationContract]
IEnumerable GetSlaves();
[OperationContract]
IEnumerable GetSlaveGroups();
[OperationContract]
void UpdateSlave(Slave slave);
[OperationContract]
void UpdateSlaveGroup(SlaveGroup slaveGroup);
[OperationContract]
void DeleteSlave(Guid slaveId);
[OperationContract]
void DeleteSlaveGroup(Guid slaveGroupId);
[OperationContract]
void AddResourceToGroup(Guid slaveGroupId, Guid resourceId);
[OperationContract]
void RemoveResourceFromGroup(Guid slaveGroupId, Guid resourceId);
[OperationContract]
Guid GetResourceId(string resourceName);
[OperationContract]
IEnumerable GetJobsByResourceId(Guid resourceId);
[OperationContract]
void TriggerLifecycle(bool force);
#endregion
#region Downtime Methods
[OperationContract]
Guid AddDowntime(Downtime downtime);
[OperationContract]
void DeleteDowntime(Guid downtimeId);
[OperationContract]
void UpdateDowntime(Downtime downtime);
[OperationContract]
IEnumerable GetDowntimesForResource(Guid resourceId);
#endregion
#region User Methods
[OperationContract]
string GetUsernameByUserId(Guid userId);
[OperationContract]
Guid GetUserIdByUsername(string username);
#endregion
}
}