public OSImage UpdateVMImageProcess(out string operationId)
		{
			operationId = string.Empty;
			OSImage oSImage = null;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					OSImage imageName = new OSImage();
					imageName.Name = this.ImageName;
					imageName.Label = this.Label;
					OSImage oSImage1 = imageName;
					CmdletExtensions.WriteVerboseOutputForObject(this, oSImage1);
					oSImage = base.RetryCall<OSImage>((string s) => base.Channel.UpdateOSImage(s, this.ImageName, oSImage1));
					Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
					ManagementOperationContext managementOperationContext = new ManagementOperationContext();
					managementOperationContext.set_OperationDescription(base.CommandRuntime.ToString());
					managementOperationContext.set_OperationId(operation.OperationTrackingId);
					managementOperationContext.set_OperationStatus(operation.Status);
					ManagementOperationContext managementOperationContext1 = managementOperationContext;
					base.WriteObject(managementOperationContext1, true);
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					this.WriteErrorDetails(communicationException);
				}
			}
			return oSImage;
		}
示例#2
0
		public IEnumerable<OSImage> GetVMImageProcess(out Operation operation)
		{
			IEnumerable<OSImage> oSImages;
			Func<string, OSImage> func = null;
			Func<string, OSImageList> func1 = null;
			operation = null;
			IEnumerable<OSImage> oSImages1 = null;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					if (string.IsNullOrEmpty(this.ImageName))
					{
						GetAzureVMImageCommand getAzureVMImageCommand = this;
						if (func1 == null)
						{
							func1 = (string s) => base.Channel.ListOSImages(s);
						}
						oSImages1 = ((CmdletBase<IServiceManagement>)getAzureVMImageCommand).RetryCall<OSImageList>(func1);
					}
					else
					{
						OSImage[] oSImageArray = new OSImage[1];
						OSImage[] oSImageArray1 = oSImageArray;
						int num = 0;
						GetAzureVMImageCommand getAzureVMImageCommand1 = this;
						if (func == null)
						{
							func = (string s) => base.Channel.GetOSImage(s, this.ImageName);
						}
						oSImageArray1[num] = ((CmdletBase<IServiceManagement>)getAzureVMImageCommand1).RetryCall<OSImage>(func);
						oSImages1 = oSImageArray;
					}
					operation = base.WaitForOperation(base.CommandRuntime.ToString());
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					if (communicationException as EndpointNotFoundException == null || base.IsVerbose())
					{
						this.WriteErrorDetails(communicationException);
					}
					else
					{
						oSImages = null;
						return oSImages;
					}
				}
				return oSImages1;
			}
			return oSImages;
		}
示例#3
0
		public void AddVMImageProcess()
		{
			AddAzureVMImageCommand.AddAzureVMImageCommand variable = null;
			string imageName;
			using (OperationContextScope operationContextScope = new OperationContextScope((IContextChannel)base.Channel))
			{
				try
				{
					AddAzureVMImageCommand.AddAzureVMImageCommand variable1 = variable;
					OSImage oSImage = new OSImage();
					oSImage.Name = this.ImageName;
					oSImage.MediaLink = new Uri(this.MediaLocation);
					OSImage oSImage1 = oSImage;
					if (string.IsNullOrEmpty(this.Label))
					{
						imageName = this.ImageName;
					}
					else
					{
						imageName = this.Label;
					}
					oSImage1.Label = imageName;
					oSImage.OS = this.OS;
					variable1.image = oSImage;
					CmdletExtensions.WriteVerboseOutputForObject(this, LambdaVar23);
					OSImage oSImage2 = base.RetryCall<OSImage>((string s) => base.Channel.CreateOSImage(s, LambdaVar23));
					OSImageContext oSImageContext = new OSImageContext();
					oSImageContext.AffinityGroup = oSImage2.AffinityGroup;
					oSImageContext.Category = oSImage2.Category;
					oSImageContext.Label = oSImage2.Label;
					oSImageContext.Location = oSImage2.Location;
					oSImageContext.MediaLink = oSImage2.MediaLink;
					oSImageContext.ImageName = oSImage2.Name;
					oSImageContext.OS = oSImage2.OS;
					OSImageContext oSImageContext1 = oSImageContext;
					Operation operation = base.WaitForOperation(base.CommandRuntime.ToString());
					oSImageContext1.set_OperationDescription(base.CommandRuntime.ToString());
					oSImageContext1.set_OperationId(operation.OperationTrackingId);
					oSImageContext1.set_OperationStatus(operation.Status);
					base.WriteObject(oSImageContext1, true);
				}
				catch (CommunicationException communicationException1)
				{
					CommunicationException communicationException = communicationException1;
					this.WriteErrorDetails(communicationException);
				}
			}
		}
 public IAsyncResult BeginUpdateOSImage(string subscriptionID, string imageName, OSImage image, AsyncCallback callback, object state)
 {
     throw new NotImplementedException();
 }
示例#5
0
 public static OSImage UpdateOSImage(this IServiceManagement proxy, string subscriptionID, string imageName, OSImage image)
 {
     return proxy.EndUpdateOSImage(proxy.BeginUpdateOSImage(subscriptionID, imageName, image, null, null));
 }
示例#6
0
 public static OSImage CreateOSImage(this IServiceManagement proxy, string subscriptionID, OSImage image)
 {
     return proxy.EndCreateOSImage(proxy.BeginCreateOSImage(subscriptionID, image, null, null));
 }
 public static OSImage CreateOSImage(this IServiceManagement proxy, string subscriptionID, OSImage image)
 {
     return(proxy.EndCreateOSImage(proxy.BeginCreateOSImage(subscriptionID, image, null, null)));
 }
 public static OSImage UpdateOSImage(this IServiceManagement proxy, string subscriptionID, string imageName, OSImage image)
 {
     return(proxy.EndUpdateOSImage(proxy.BeginUpdateOSImage(subscriptionID, imageName, image, null, null)));
 }