public RemoveSnapshot ( |
||
vmConfig | ||
snapshotTag | string | |
virtualMachineExtensionBaseCmdlet | VirtualMachineExtensionBaseCmdlet | |
Résultat | void |
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName); var currentOSType = virtualMachineResponse.Body.StorageProfile.OsDisk.OsType; if (OperatingSystemTypes.Linux.Equals(currentOSType)) { AzureVMBackupExtensionUtil util = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; util.RemoveSnapshot(vmConfig, Tag, this); } else { ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "The VM should be a Linux VM")), "InvalidArgument", ErrorCategory.InvalidArgument, null)); } }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName); var currentOSType = virtualMachineResponse.Body.StorageProfile.OsDisk.OsType; if (OperatingSystemTypes.Linux.Equals(currentOSType)) { AzureVMBackupExtensionUtil util = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; util.RemoveSnapshot(vmConfig, Tag, this); } else { ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "The VM should be a Linux VM")), "InvalidArgument", ErrorCategory.InvalidArgument, null)); } }
protected override void ProcessRecord() { base.ProcessRecord(); VirtualMachineGetResponse virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName); string currentOSType = virtualMachineResponse.VirtualMachine.StorageProfile.OSDisk.OperatingSystemType; if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) { AzureVMBackupExtensionUtil util = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; util.RemoveSnapshot(vmConfig, Tag, this); } else { ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "The VM should be a Linux VM")), "InvalidArgument", ErrorCategory.InvalidArgument, null)); } }
protected override void ProcessRecord() { base.ProcessRecord(); VirtualMachineGetResponse virtualMachineResponse = this.ComputeClient.ComputeManagementClient.VirtualMachines.GetWithInstanceView(this.ResourceGroupName, VMName); string currentOSType = virtualMachineResponse.VirtualMachine.StorageProfile.OSDisk.OperatingSystemType; if (string.Equals(currentOSType, "Linux", StringComparison.InvariantCultureIgnoreCase)) { AzureVMBackupExtensionUtil util = new AzureVMBackupExtensionUtil(); AzureVMBackupConfig vmConfig = new AzureVMBackupConfig(); vmConfig.ResourceGroupName = ResourceGroupName; vmConfig.VMName = VMName; vmConfig.VirtualMachineExtensionType = VirtualMachineExtensionType; util.RemoveSnapshot(vmConfig, Tag, this); } else { ThrowTerminatingError(new ErrorRecord(new ArgumentException(string.Format(CultureInfo.CurrentUICulture, "The VM should be a Linux VM")), "InvalidArgument", ErrorCategory.InvalidArgument, null)); } }