コード例 #1
0
        /// <summary>
        /// Enumerate infos of all cloud services.
        /// </summary>
        public List <CloudServiceInfo> GetServices()
        {
            // TODO: Redesign to make it self-contained (so that we don't need to pass the name as well)

            return(_blobs.ListBlobNames(CloudServiceStateName.GetPrefix())
                   .Select(name => System.Tuple.Create(name, _blobs.GetBlob(name, _runtimeSerializer)))
                   .Where(pair => pair.Item2.HasValue)
                   .Select(pair => new CloudServiceInfo
            {
                ServiceName = pair.Item1.ServiceName,
                IsStarted = pair.Item2.Value == CloudServiceState.Started
            })
                   .ToList());
        }
コード例 #2
0
 /// <summary>
 /// Enumerate the names of all cloud services.
 /// </summary>
 public List <string> GetServiceNames()
 {
     return(_blobs.ListBlobNames(CloudServiceStateName.GetPrefix())
            .Select(reference => reference.ServiceName).ToList());
 }
コード例 #3
0
ファイル: CloudServices.cs プロジェクト: cdrnet/Lokad.Cloud
		/// <summary>
		/// Remove the state information of a cloud service
		/// </summary>
		public void ResetServiceState(string serviceName)
		{
			var blobRef = new CloudServiceStateName(serviceName);
			_blobProvider.DeleteBlob(blobRef);
		}
コード例 #4
0
ファイル: CloudServices.cs プロジェクト: cdrnet/Lokad.Cloud
		/// <summary>
		/// Enable a cloud service
		/// </summary>
		public void EnableService(string serviceName)
		{
			var blobRef = new CloudServiceStateName(serviceName);
			_blobProvider.PutBlob(blobRef, CloudServiceState.Started);
		}
コード例 #5
0
ファイル: CloudServices.cs プロジェクト: cdrnet/Lokad.Cloud
		/// <summary>
		/// Toggle the state of a cloud service
		/// </summary>
		public void ToggleServiceState(string serviceName)
		{
			var blobRef = new CloudServiceStateName(serviceName);
			_blobProvider.UpdateIfNotModified(
				blobRef,
				s => s.HasValue
					? (s.Value == CloudServiceState.Started ? CloudServiceState.Stopped : CloudServiceState.Started)
					: CloudServiceState.Started);
		}