public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.WorkspaceObject)) { this.ResourceGroupName = new ResourceIdentifier(this.WorkspaceObject.Id).ResourceGroupName; this.WorkspaceName = this.WorkspaceObject.Name; } if (this.IsParameterBound(c => c.InputObject)) { var resourceIdentifier = new ResourceIdentifier(this.InputObject.Id); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.WorkspaceName = resourceIdentifier.ParentResource; this.WorkspaceName = this.WorkspaceName.Substring(this.WorkspaceName.LastIndexOf('/') + 1); this.Name = resourceIdentifier.ResourceName; } if (this.IsParameterBound(c => c.ResourceId)) { var resourceIdentifier = new ResourceIdentifier(this.ResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.WorkspaceName = resourceIdentifier.ParentResource; this.WorkspaceName = this.WorkspaceName.Substring(this.WorkspaceName.LastIndexOf('/') + 1); this.Name = resourceIdentifier.ResourceName; } if (this.ShouldProcess(this.Name, string.Format(Resources.CreatingSqlPoolRestorePoint, this.Name, this.WorkspaceName))) { CreateSqlPoolRestorePointDefinition parameters = new CreateSqlPoolRestorePointDefinition(this.RestorePointLabel); var result = new PSRestorePoint(this.SynapseAnalyticsClient.CreateSqlPoolRestorePoint(this.ResourceGroupName, this.WorkspaceName, this.Name, parameters)); WriteObject(result); } }
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.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); }); }