public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { string resourceGroup = this.ResourceGroupName; string restorePointName = this.Name; string restorePointCollectionName = this.RestorePointCollectionName; bool instanceViewTrue = this.InstanceView.IsPresent; if (instanceViewTrue == true) { var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName, "InstanceView"); var psObject = new PSRestorePoint(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePoint, PSRestorePoint>(result, psObject); WriteObject(psObject); } else { var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName); var psObject = new PSRestorePoint(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePoint, PSRestorePoint>(result, psObject); WriteObject(psObject); } }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { if (ShouldProcess(this.Name, VerbsCommon.Remove)) { string resourceGroup = this.ResourceGroupName; string restorePointName = this.Name; string restorePointCollectionName = this.RestorePointCollectionName; var result = RestorePointClient.DeleteWithHttpMessagesAsync(resourceGroup, restorePointCollectionName, restorePointName).GetAwaiter().GetResult(); PSOperationStatusResponse output = new PSOperationStatusResponse { StartTime = this.StartTime, EndTime = DateTime.Now }; if (result != null && result.Request != null && result.Request.RequestUri != null) { output.Name = GetOperationIdFromUrlString(result.Request.RequestUri.ToString()); } WriteObject(output); } }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { if (ShouldProcess(this.Name, VerbsCommon.New)) { string resourceGroup = this.ResourceGroupName; string restorePointName = this.Name; string restorePointCollectionName = this.RestorePointCollectionName; List <ApiEntityReference> disksExclude = new List <ApiEntityReference>(); RestorePoint restorePoint = new RestorePoint(); if (this.IsParameterBound(c => c.DisksToExclude)) { foreach (string s in DisksToExclude) { disksExclude.Add(new ApiEntityReference(s)); } restorePoint.ExcludeDisks = disksExclude; var result = RestorePointClient.Create(resourceGroup, restorePointCollectionName, restorePointName, restorePoint); var psObject = new PSRestorePoint(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePoint, PSRestorePoint>(result, psObject); WriteObject(psObject); } else { var result = RestorePointClient.Create(resourceGroup, restorePointCollectionName, restorePointName, restorePoint); var psObject = new PSRestorePoint(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePoint, PSRestorePoint>(result, psObject); WriteObject(psObject); } } }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { string resourceGroup = this.ResourceGroupName; string restorePointName = this.Name; string restorePointCollectionName = this.RestorePointCollectionName; var result = RestorePointClient.Get(resourceGroup, restorePointCollectionName, restorePointName); var psObject = new PSRestorePoint(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePoint, PSRestorePoint>(result, psObject); WriteObject(psObject); }); }