protected override void ProcessRecord() { ComputeAutomationAutoMapperProfile.Initialize(); ExecuteClientAction(() => { if (ShouldProcess(this.ResourceGroupName, VerbsData.Update)) { string resourceGroupName = this.ResourceGroupName; string snapshotName = this.SnapshotName; Snapshot snapshotObj = new Snapshot(); Mapper.Map <PSSnapshot, Snapshot>(this.Snapshot, snapshotObj); SnapshotUpdate snapshotUpdateObj = new SnapshotUpdate(); Mapper.Map <PSSnapshotUpdate, SnapshotUpdate>(this.SnapshotUpdate, snapshotUpdateObj); var result = (this.SnapshotUpdate == null) ? SnapshotsClient.CreateOrUpdate(resourceGroupName, snapshotName, snapshotObj) : SnapshotsClient.Update(resourceGroupName, snapshotName, snapshotUpdateObj); var psObject = new PSSnapshot(); Mapper.Map <Snapshot, PSSnapshot>(result, psObject); WriteObject(psObject); } }); }
protected override void ProcessRecord() { ComputeAutomationAutoMapperProfile.Initialize(); ExecuteClientAction(() => { if (ShouldProcess(this.ResourceGroupName, VerbsData.Update)) { string resourceGroupName = this.ResourceGroupName; string diskName = this.DiskName; Disk diskObj = new Disk(); Mapper.Map <PSDisk, Disk>(this.Disk, diskObj); DiskUpdate diskUpdateObj = new DiskUpdate(); Mapper.Map <PSDiskUpdate, DiskUpdate>(this.DiskUpdate, diskUpdateObj); var result = (this.DiskUpdate == null) ? DisksClient.CreateOrUpdate(resourceGroupName, diskName, diskObj) : DisksClient.Update(resourceGroupName, diskName, diskUpdateObj); var psObject = new PSDisk(); Mapper.Map <Disk, PSDisk>(result, psObject); WriteObject(psObject); } }); }
protected override void ProcessRecord() { ComputeAutomationAutoMapperProfile.Initialize(); ExecuteClientAction(() => { if (ShouldProcess(this.ResourceGroupName, VerbsCommon.New)) { string resourceGroupName = this.ResourceGroupName; string diskName = this.DiskName; Disk disk = new Disk(); Mapper.Map <PSDisk, Disk>(this.Disk, disk); var result = DisksClient.CreateOrUpdate(resourceGroupName, diskName, disk); PSDisk psResult = new PSDisk(); Mapper.Map <Disk, PSDisk>(result, psResult); WriteObject(psResult); } }); }
protected override void ProcessRecord() { ComputeAutomationAutoMapperProfile.Initialize(); ExecuteClientAction(() => { if (ShouldProcess(this.ResourceGroupName, VerbsCommon.New)) { string resourceGroupName = this.ResourceGroupName; string snapshotName = this.SnapshotName; Snapshot snapshot = new Snapshot(); Mapper.Map <PSSnapshot, Snapshot>(this.Snapshot, snapshot); var result = SnapshotsClient.CreateOrUpdate(resourceGroupName, snapshotName, snapshot); PSSnapshot psResult = new PSSnapshot(); Mapper.Map <Snapshot, PSSnapshot>(result, psResult); WriteObject(psResult); } }); }
public override void ExecuteCmdlet() { base.ExecuteCmdlet(); ComputeAutomationAutoMapperProfile.Initialize(); }