public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { if (ShouldProcess(this.Name, VerbsCommon.Remove)) { string resourceGroup = this.ResourceGroupName; string restorePointCollectionName = this.Name; RestorePointCollectionUpdate update = new RestorePointCollectionUpdate(); var result = RestorePointCollectionsClient.DeleteWithHttpMessagesAsync(resourceGroup, restorePointCollectionName).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 restorePointCollectionName = this.Name; string vmId = this.VmId; string location = this.Location; RestorePointCollection restorePointCollection = new RestorePointCollection(location); restorePointCollection.Source = new RestorePointCollectionSourceProperties() { Id = vmId }; var result = RestorePointCollectionsClient.CreateOrUpdate(resourceGroup, restorePointCollectionName, restorePointCollection); var psObject = new PSRestorePointCollection(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePointCollection, PSRestorePointCollection>(result, psObject); WriteObject(psObject); } }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { string resourceGroup = this.ResourceGroupName; string restorePointCollectionName = this.Name; var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName, "restorePoints"); var psObject = new PSRestorePointCollection(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePointCollection, PSRestorePointCollection>(result, psObject); WriteObject(psObject); }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ExecuteClientAction(() => { if (ShouldProcess(this.Name, VerbsData.Update)) { string resourceGroup = this.ResourceGroupName; string restorePointCollectionName = this.Name; RestorePointCollectionUpdate update = new RestorePointCollectionUpdate(); if (this.IsParameterBound(c => c.Tag)) { update.Tags = this.Tag.Cast <DictionaryEntry>().ToDictionary(ht => (string)ht.Key, ht => (string)ht.Value); } RestorePointCollectionsClient.Update(resourceGroup, restorePointCollectionName, update); var result = RestorePointCollectionsClient.Get(resourceGroup, restorePointCollectionName); var psObject = new PSRestorePointCollection(); ComputeAutomationAutoMapperProfile.Mapper.Map <RestorePointCollection, PSRestorePointCollection>(result, psObject); WriteObject(psObject); } }); }