Esempio n. 1
0
        public override void ExecuteCmdlet()
        {
            ConfirmAction(Force.IsPresent,
                          Resources.RemoveWarningVolume,
                          Resources.RemoveConfirmationVolume,
                          string.Empty,
                          () =>
            {
                try
                {
                    var deviceid = StorSimpleClient.GetDeviceId(DeviceName);

                    if (deviceid == null)
                    {
                        WriteVerbose(string.Format(Resources.NoDeviceFoundWithGivenNameInResourceMessage, StorSimpleContext.ResourceName, DeviceName));
                        WriteObject(null);
                        return;
                    }

                    if (WaitForComplete.IsPresent)
                    {
                        WriteVerbose("About to run a task to remove your Volume container!");
                        var taskstatusInfo = StorSimpleClient.DeleteDataContainer(deviceid, VolumeContainer.InstanceId);
                        HandleSyncTaskResponse(taskstatusInfo, "delete");
                    }
                    else
                    {
                        WriteVerbose("About to create a task to remove your Volume container!");
                        var taskresult = StorSimpleClient.DeleteDataContainerAsync(deviceid, VolumeContainer.InstanceId);
                        HandleAsyncTaskResponse(taskresult, "delete");
                    }
                }
                catch (Exception exception)
                {
                    this.HandleException(exception);
                }
            });
        }