/Source/RemoveFIMResource.cs
C# | 40 lines | 35 code | 5 blank | 0 comment | 1 complexity | 67b8a073bfd61b78c88e3b43ab930822 MD5 | raw file
- using System;
- using System.Management.Automation;
- using Microsoft.ResourceManagement.ObjectModel;
-
- namespace Quest.FIMPowerShellSnapin
- {
- [Cmdlet(VerbsCommon.Remove, Constants.Nouns.FIMResource, SupportsShouldProcess = true)]
- public class RemoveFIMResource : PSCmdlet
- {
- private String _objectID;
- private FIMPSSession _session;
-
- [Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
- [ValidateNotNullOrEmpty]
- public String ObjectID
- {
- get { return _objectID; }
- set { _objectID = value; }
- }
-
- [Parameter(Mandatory = true, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
- [ValidateNotNullOrEmpty]
- public FIMPSSession Session
- {
- get { return _session; }
- set { _session = value; }
- }
-
- protected override void ProcessRecord()
- {
- bool shouldProcess = ShouldProcess(Constants.Messages.VerboseRemove, Constants.Messages.ConfirmRemove, _objectID);
-
- if (shouldProcess)
- {
- RmReference id = new RmReference(_objectID);
- _session.Client.Delete(id); //!!! should we do anything with the return value?
- }
- }
- }
- }