Cmdlets/Rm-IonRecord/RmIonRecordCmd.cs
using System.Management.Automation;
namespace IonMod { [Cmdlet(VerbsCommon.Remove, "IonRecord")] public class RemoveIonRecordCmd : PSCmdlet { [Parameter(Mandatory = true, ParameterSetName = "stringIds")] [Parameter(Mandatory = true, ParameterSetName = "stringId+RecObj")] public string ZoneId; [Parameter(Mandatory = true, ParameterSetName = "stringIds")] [Parameter(Mandatory = true, ParameterSetName = "ZoneObj+stringId")] public string RecordId; [Parameter(Mandatory = true, ParameterSetName = "ZoneObj+stringId", ValueFromPipeline = true)] [Parameter(Mandatory = true, ParameterSetName = "ZoneObj+RecObj", ValueFromPipeline = true)] public IonZone Zone; [Parameter(Mandatory = true, ParameterSetName = "stringId+RecObj", ValueFromPipeline = true)] [Parameter(Mandatory = true, ParameterSetName = "ZoneObj+RecObj")] public IonRecord Record; protected override void ProcessRecord() { switch (ParameterSetName) { case "stringId+RecObj": RecordId = Record.Id; break; case "ZoneObj+stringId": ZoneId = Zone.Id; break; case "ZoneObj+RecObj": ZoneId = Zone.Id; RecordId = Record.Id; break; } RmIonRecord.Run(ZoneId, RecordId); } } } |