// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #nullable enable namespace System.Management.Automation.Provider { #region IDynamicPropertyCmdletProvider /// /// An interface that can be implemented on a Cmdlet provider to expose the dynamic /// manipulation of properties. /// /// /// An IDynamicPropertyCmdletProvider provider implements a set of methods that allows /// the use of a set of core commands against the data store that the provider /// gives access to. By implementing this interface users can take advantage /// the commands that expose the creation and deletion of properties on an item. /// rename-itemproperty /// remove-itemproperty /// new-itemproperty /// etc. /// This interface should only be implemented on derived classes of /// , , /// , or . /// /// A Cmdlet provider should implemented this interface if items in the /// namespace have dynamic properties the provide wishes to expose. /// public interface IDynamicPropertyCmdletProvider : IPropertyCmdletProvider { /// /// Creates a new property on the specified item. /// /// /// The path to the item on which the new property should be created. /// /// /// The name of the property that should be created. /// /// /// The type of the property that should be created. /// /// /// The new value of the property that should be created. /// /// /// Nothing. The new property that was created should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to add properties to provider objects /// using the new-itemproperty cmdlet. /// /// Providers that declare /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those /// requirements by accessing the appropriate property from the base class. /// /// By default overrides of this method should not create new properties on objects that are generally hidden from /// the user unless the Force property is set to true. An error should be sent to the WriteError method if /// the path represents an item that is hidden from the user and Force is set to false. /// void NewProperty( string path, string propertyName, string propertyTypeName, object? value); /// /// Gives the provider an opportunity to attach additional parameters to the /// new-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// The name of the property that should be created. /// /// /// The type of the property that should be created. /// /// /// The new value of the property that should be created. /// /// /// Overrides of this method should return an object that has properties and fields decorated with /// parsing attributes similar to a cmdlet class or a /// . /// /// The default implementation returns null. (no additional parameters) /// object? NewPropertyDynamicParameters( string path, string propertyName, string propertyTypeName, object? value); /// /// Removes a property on the item specified by the path. /// /// /// The path to the item on which the property should be removed. /// /// /// The name of the property to be removed. /// /// /// Nothing. /// /// /// Providers override this method to give the user the ability to remove properties from provider objects /// using the remove-itemproperty cmdlet. /// /// Providers that declare /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those /// requirements by accessing the appropriate property from the base class. /// /// By default overrides of this method should not remove properties on objects that are generally hidden from /// the user unless the Force property is set to true. An error should be sent to the WriteError method if /// the path represents an item that is hidden from the user and Force is set to false. /// void RemoveProperty( string path, string propertyName); /// /// Gives the provider an opportunity to attach additional parameters to the /// remove-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// The name of the property that should be removed. /// /// /// Overrides of this method should return an object that has properties and fields decorated with /// parsing attributes similar to a cmdlet class or a /// . /// /// The default implementation returns null. (no additional parameters) /// object RemovePropertyDynamicParameters( string path, string propertyName); /// /// Renames a property of the item at the specified path. /// /// /// The path to the item on which to rename the property. /// /// /// The property to rename. /// /// /// The new name of the property. /// /// /// Nothing. The new property that was renamed should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to rename properties of provider objects /// using the rename-itemproperty cmdlet. /// /// Providers that declare /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those /// requirements by accessing the appropriate property from the base class. /// /// By default overrides of this method should not rename properties on objects that are generally hidden from /// the user unless the Force property is set to true. An error should be sent to the WriteError method if /// the path represents an item that is hidden from the user and Force is set to false. /// void RenameProperty( string path, string sourceProperty, string destinationProperty); /// /// Gives the provider an opportunity to attach additional parameters to the /// rename-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// The property to rename. /// /// /// The new name of the property. /// /// /// Overrides of this method should return an object that has properties and fields decorated with /// parsing attributes similar to a cmdlet class or a /// . /// /// The default implementation returns null. (no additional parameters) /// object? RenamePropertyDynamicParameters( string path, string sourceProperty, string destinationProperty); /// /// Copies a property of the item at the specified path to a new property on the /// destination item. /// /// /// The path to the item on which to copy the property. /// /// /// The name of the property to copy. /// /// /// The path to the item on which to copy the property to. /// /// /// The destination property to copy to. /// /// /// Nothing. The new property that was copied to should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to copy properties of provider objects /// using the copy-itemproperty cmdlet. /// /// Providers that declare /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those /// requirements by accessing the appropriate property from the base class. /// /// By default overrides of this method should not copy properties from or to objects that are generally hidden from /// the user unless the Force property is set to true. An error should be sent to the WriteError method if /// the path represents an item that is hidden from the user and Force is set to false. /// void CopyProperty( string sourcePath, string sourceProperty, string destinationPath, string destinationProperty); /// /// Gives the provider an opportunity to attach additional parameters to the /// copy-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// The name of the property to copy. /// /// /// The path to the item on which to copy the property to. /// /// /// The destination property to copy to. /// /// /// Overrides of this method should return an object that has properties and fields decorated with /// parsing attributes similar to a cmdlet class or a /// . /// /// The default implementation returns null. (no additional parameters) /// object? CopyPropertyDynamicParameters( string sourcePath, string sourceProperty, string destinationPath, string destinationProperty); /// /// Moves a property on an item specified by the path. /// /// /// The path to the item on which to move the property. /// /// /// The name of the property to move. /// /// /// The path to the item on which to move the property to. /// /// /// The destination property to move to. /// /// /// Nothing. The new property that was created should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to move properties from one provider object /// to another using the move-itemproperty cmdlet. /// /// Providers that declare /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those /// requirements by accessing the appropriate property from the base class. /// /// By default overrides of this method should not move properties on or to objects that are generally hidden from /// the user unless the Force property is set to true. An error should be sent to the WriteError method if /// the path represents an item that is hidden from the user and Force is set to false. /// void MoveProperty( string sourcePath, string sourceProperty, string destinationPath, string destinationProperty); /// /// Gives the provider an opportunity to attach additional parameters to the /// move-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// The name of the property to copy. /// /// /// The path to the item on which to copy the property to. /// /// /// The destination property to copy to. /// /// /// Overrides of this method should return an object that has properties and fields decorated with /// parsing attributes similar to a cmdlet class or a /// . /// /// The default implementation returns null. (no additional parameters) /// object? MovePropertyDynamicParameters( string sourcePath, string sourceProperty, string destinationPath, string destinationProperty); } #endregion IDynamicPropertyCmdletProvider }