Ejemplo n.º 1
0
		public IEnumerable<Disk> GetDiskProcess(out Operation operation)
		{
			IEnumerable<Disk> disks;
			Func<string, Disk> func = null;
			Func<string, DiskList> func1 = null;
			IEnumerable<Disk> disks1 = null;
			operation = null;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					if (string.IsNullOrEmpty(this.DiskName))
					{
						GetAzureDiskCommand getAzureDiskCommand = this;
						if (func1 == null)
						{
							func1 = (string s) => base.Channel.ListDisks(s);
						}
						disks1 = ((CmdletBase<IServiceManagement>)getAzureDiskCommand).RetryCall<DiskList>(func1);
					}
					else
					{
						Disk[] diskArray = new Disk[1];
						Disk[] diskArray1 = diskArray;
						int num = 0;
						GetAzureDiskCommand getAzureDiskCommand1 = this;
						if (func == null)
						{
							func = (string s) => base.Channel.GetDisk(s, this.DiskName);
						}
						diskArray1[num] = ((CmdletBase<IServiceManagement>)getAzureDiskCommand1).RetryCall<Disk>(func);
						disks1 = diskArray;
					}
					operation = base.WaitForOperation(base.CommandRuntime.ToString());
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					if (communicationException as EndpointNotFoundException == null || base.IsVerbose())
					{
						this.WriteErrorDetails(communicationException);
					}
					else
					{
						disks = null;
						return disks;
					}
				}
				return disks1;
			}
			return disks;
		}
Ejemplo n.º 2
0
		public void AddDiskProcess()
		{
			AddAzureDiskCommand.AddAzureDiskCommand variable = null;
			string diskName;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					AddAzureDiskCommand.AddAzureDiskCommand variable1 = variable;
					Disk disk = new Disk();
					disk.Name = this.DiskName;
					disk.MediaLink = new Uri(this.MediaLocation);
					disk.OS = this.OS;
					Disk disk1 = disk;
					if (string.IsNullOrEmpty(this.Label))
					{
						diskName = this.DiskName;
					}
					else
					{
						diskName = this.Label;
					}
					disk1.Label = diskName;
					variable1.disk = disk;
					CmdletExtensions.WriteVerboseOutputForObject(this, LambdaVar22);
					Disk disk2 = base.RetryCall<Disk>((string s) => base.Channel.CreateDisk(s, LambdaVar22));
					DiskContext diskContext = new DiskContext();
					diskContext.DiskName = disk2.Name;
					diskContext.Label = disk2.Label;
					diskContext.IsCorrupted = disk2.IsCorrupted;
					diskContext.AffinityGroup = disk2.AffinityGroup;
					diskContext.OS = disk2.OS;
					diskContext.Location = disk2.Location;
					diskContext.MediaLink = disk2.MediaLink;
					diskContext.DiskSizeInGB = disk2.LogicalDiskSizeInGB;
					diskContext.SourceImageName = disk2.SourceImageName;
					diskContext.AttachedTo = AddAzureDiskCommand.CreateRoleReference(disk2.AttachedTo);
					DiskContext diskContext1 = diskContext;
					Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
					diskContext1.set_OperationDescription(base.CommandRuntime.ToString());
					diskContext1.set_OperationId(operation.OperationTrackingId);
					diskContext1.set_OperationStatus(operation.Status);
					base.WriteObject(diskContext1, true);
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					this.WriteErrorDetails(communicationException);
				}
			}
		}
Ejemplo n.º 3
0
		public void UpdateDiskProcess()
		{
			string empty = string.Empty;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					Disk disk = new Disk();
					disk.Name = this.DiskName;
					disk.Label = this.Label;
					Disk disk1 = disk;
					CmdletExtensions.WriteVerboseOutputForObject(this, disk1);
					Disk disk2 = base.RetryCall<Disk>((string s) => base.Channel.UpdateDisk(s, this.DiskName, disk1));
					if (disk2 != null)
					{
						DiskContext diskContext = new DiskContext();
						diskContext.set_OperationId(empty);
						diskContext.DiskName = disk1.Name;
						diskContext.Label = disk1.Label;
						diskContext.IsCorrupted = disk1.IsCorrupted;
						diskContext.AffinityGroup = disk1.AffinityGroup;
						diskContext.OS = disk1.OS;
						diskContext.Location = disk1.Location;
						diskContext.MediaLink = disk1.MediaLink;
						diskContext.DiskSizeInGB = disk1.LogicalDiskSizeInGB;
						diskContext.SourceImageName = disk1.SourceImageName;
						diskContext.AttachedTo = UpdateAzureDiskCommand.CreateRoleReference(disk1.AttachedTo);
						DiskContext diskContext1 = diskContext;
						Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
						diskContext1.set_OperationDescription(base.CommandRuntime.ToString());
						diskContext1.set_OperationId(operation.OperationTrackingId);
						diskContext1.set_OperationStatus(operation.Status);
						base.WriteObject(diskContext1, true);
					}
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					this.WriteErrorDetails(communicationException);
				}
			}
		}
 public IAsyncResult BeginUpdateDisk(string subscriptionID, string diskName, Disk disk, AsyncCallback callback, object state)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 5
0
 public static Disk UpdateDisk(this IServiceManagement proxy, string subscriptionID, string diskName, Disk disk)
 {
     return proxy.EndUpdateDisk(proxy.BeginUpdateDisk(subscriptionID, diskName, disk, null, null));
 }
Ejemplo n.º 6
0
 public static Disk CreateDisk(this IServiceManagement proxy, string subscriptionID, Disk disk)
 {
     return proxy.EndCreateDisk(proxy.BeginCreateDisk(subscriptionID, disk, null, null));
 }
 public static Disk CreateDisk(this IServiceManagement proxy, string subscriptionID, Disk disk)
 {
     return(proxy.EndCreateDisk(proxy.BeginCreateDisk(subscriptionID, disk, null, null)));
 }
 public static Disk UpdateDisk(this IServiceManagement proxy, string subscriptionID, string diskName, Disk disk)
 {
     return(proxy.EndUpdateDisk(proxy.BeginUpdateDisk(subscriptionID, diskName, disk, null, null)));
 }