// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Collections.ObjectModel; #nullable enable namespace System.Management.Automation.Provider { #region IPropertyCmdletProvider /// /// An interface that can be implemented by a Cmdlet provider to expose properties of an item. /// /// /// An IPropertyCmdletProvider 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 contents of an item. /// get-itemproperty /// set-itemproperty /// etc. /// This interface should only be implemented on derived classes of /// , , /// , or . /// /// A namespace provider should implemented this interface if items in the /// namespace have properties the provide wishes to expose. /// public interface IPropertyCmdletProvider { /// /// Gets the properties of the item specified by the path. /// /// /// The path to the item to retrieve properties from. /// /// /// A list of properties that should be retrieved. If this parameter is null /// or empty, all properties should be retrieved. /// /// /// Nothing. The property that was retrieved 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 get-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 retrieve properties from 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. /// /// An can be used as a property bag for the /// properties that need to be returned if the contains /// multiple properties to write. /// void GetProperty( string path, Collection? providerSpecificPickList); /// /// Gives the provider an opportunity to attach additional parameters to the /// get-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// A list of properties that should be retrieved. If this parameter is null /// or empty, all properties should be retrieved. /// /// /// 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? GetPropertyDynamicParameters( string path, Collection? providerSpecificPickList); /// /// Sets the specified properties of the item at the specified path. /// /// /// The path to the item to set the properties on. /// /// /// A PSObject which contains a collection of the name, type, value /// of the properties to be set. /// /// /// Nothing. The property that was set should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to set the value of provider object properties /// using the set-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 retrieve properties from 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. /// /// An can be used as a property bag for the /// properties that need to be returned if the contains /// multiple properties to write. /// is a property bag containing the properties that should be set. /// See for more information. /// void SetProperty( string path, PSObject propertyValue); /// /// Gives the provider an opportunity to attach additional parameters to the /// get-itemproperty cmdlet. /// /// /// If the path was specified on the command line, this is the path /// to the item to get the dynamic parameters for. /// /// /// A PSObject which contains a collection of the name, type, value /// of the properties to be set. /// /// /// 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? SetPropertyDynamicParameters( string path, PSObject propertyValue); /// /// Clears a property of the item at the specified path. /// /// /// The path to the item on which to clear the property. /// /// /// The name of the property to clear. /// /// /// Nothing. The property that was cleared should be passed to the WritePropertyObject method. /// /// /// Providers override this method to give the user the ability to clear the value of provider object properties /// using the clear-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 clear properties from 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. /// /// An can be used as a property bag for the /// properties that need to be returned if the contains /// multiple properties to write. /// void ClearProperty( string path, Collection propertyToClear); /// /// Gives the provider an opportunity to attach additional parameters to the /// clear-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 clear. /// /// /// 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? ClearPropertyDynamicParameters( string path, Collection propertyToClear); } #endregion IPropertyCmdletProvider }