예제 #1
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);
				}
			}
		}
예제 #2
0
		protected override void ProcessRecord()
		{
			try
			{
				base.ProcessRecord();
				Operation operation = null;
				IEnumerable<Disk> diskProcess = this.GetDiskProcess(out operation);
				if (diskProcess != null)
				{
					List<DiskContext> diskContexts = new List<DiskContext>();
					foreach (Disk disk in diskProcess)
					{
						DiskContext diskContext = new DiskContext();
						diskContext.set_OperationId(operation.OperationTrackingId);
						diskContext.set_OperationDescription(base.CommandRuntime.ToString());
						diskContext.set_OperationStatus(operation.Status);
						diskContext.DiskName = disk.Name;
						diskContext.Label = disk.Label;
						diskContext.IsCorrupted = disk.IsCorrupted;
						diskContext.AffinityGroup = disk.AffinityGroup;
						diskContext.OS = disk.OS;
						diskContext.Location = disk.Location;
						diskContext.MediaLink = disk.MediaLink;
						diskContext.DiskSizeInGB = disk.LogicalDiskSizeInGB;
						diskContext.SourceImageName = disk.SourceImageName;
						diskContext.AttachedTo = GetAzureDiskCommand.CreateRoleReference(disk.AttachedTo);
						diskContexts.Add(diskContext);
					}
					base.WriteObject(diskContexts, true);
				}
			}
			catch (Exception exception1)
			{
				Exception exception = exception1;
				base.WriteError(new ErrorRecord(exception, string.Empty, ErrorCategory.CloseError, null));
			}
		}