MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4#nullable enable5namespace System.Management.Automation.Provider6{7 #region IContentCmdletProvider8 9 /// <summary>10 /// An interface that can be implemented on a Cmdlet provider to expose an item's11 /// content.12 /// </summary>13 /// <remarks>14 /// An IContentCmdletProvider provider implements a set of methods that allows15 /// the use of a set of core commands against the data store that the provider16 /// gives access to. By implementing this interface users can take advantage17 /// the commands that expose the contents of an item.18 /// get-content19 /// set-content20 /// clear-content21 ///22 /// This interface should only be implemented on derived classes of23 /// <see cref="CmdletProvider"/>, <see cref="ItemCmdletProvider"/>,24 /// <see cref="ContainerCmdletProvider"/>, or <see cref="NavigationCmdletProvider"/>.25 ///26 /// A namespace provider should implemented this interface if items in the27 /// namespace have content the provide wishes to expose.28 /// </remarks>29 public interface IContentCmdletProvider30 {31 /// <summary>32 /// Gets the content reader for the item at the specified path.33 /// </summary>34 /// <param name="path">35 /// The path to the item to get the content reader for.36 /// </param>37 /// <remarks>38 /// Overrides of this method should return an <see cref="System.Management.Automation.Provider.IContentReader"/>39 /// for the item specified by the path.40 ///41 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>42 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those43 /// requirements by accessing the appropriate property from the base class.44 ///45 /// By default overrides of this method should not return a content reader for objects46 /// that are generally hidden from47 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if48 /// the path represents an item that is hidden from the user and Force is set to false.49 /// </remarks>50 IContentReader? GetContentReader(string path);51 52 /// <summary>53 /// Gives the provider an opportunity to attach additional parameters to the54 /// get-content cmdlet.55 /// </summary>56 /// <param name="path">57 /// If the path was specified on the command line, this is the path58 /// to the item to get the dynamic parameters for.59 /// </param>60 /// <returns>61 /// Overrides of this method should return an object that has properties and fields decorated with62 /// parsing attributes similar to a cmdlet class or a63 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.64 ///65 /// The default implementation returns null. (no additional parameters)66 /// </returns>67 object? GetContentReaderDynamicParameters(string path);68 69 /// <summary>70 /// Gets the content writer for the item at the specified path.71 /// </summary>72 /// <param name="path">73 /// The path to the item to get the content writer for.74 /// </param>75 /// <returns>76 /// An IContentWriter for the item at the specified path.77 /// </returns>78 /// <remarks>79 /// Overrides of this method should return an <see cref="System.Management.Automation.Provider.IContentWriter"/>80 /// for the item specified by the path.81 ///82 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>83 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those84 /// requirements by accessing the appropriate property from the base class.85 ///86 /// By default overrides of this method should not return a content writer for objects87 /// that are generally hidden from88 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if89 /// the path represents an item that is hidden from the user and Force is set to false.90 /// </remarks>91 IContentWriter? GetContentWriter(string path);92 93 /// <summary>94 /// Gives the provider an opportunity to attach additional parameters to the95 /// set-content and add-content cmdlet.96 /// </summary>97 /// <param name="path">98 /// If the path was specified on the command line, this is the path99 /// to the item to get the dynamic parameters for.100 /// </param>101 /// <returns>102 /// Overrides of this method should return an object that has properties and fields decorated with103 /// parsing attributes similar to a cmdlet class or a104 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.105 ///106 /// The default implementation returns null. (no additional parameters)107 /// </returns>108 object? GetContentWriterDynamicParameters(string path);109 110 /// <summary>111 /// Clears the content from the specified item.112 /// </summary>113 /// <param name="path">114 /// The path to the item to clear the content from.115 /// </param>116 /// <remarks>117 /// Overrides of this method should remove any content from the object but118 /// not remove (delete) the object itself.119 ///120 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>121 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those122 /// requirements by accessing the appropriate property from the base class.123 ///124 /// By default overrides of this method should not clear or write objects that are generally hidden from125 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if126 /// the path represents an item that is hidden from the user and Force is set to false.127 /// </remarks>128 void ClearContent(string path);129 130 /// <summary>131 /// Gives the provider an opportunity to attach additional parameters to the132 /// clear-content cmdlet.133 /// </summary>134 /// <param name="path">135 /// If the path was specified on the command line, this is the path136 /// to the item to get the dynamic parameters for.137 /// </param>138 /// <returns>139 /// Overrides of this method should return an object that has properties and fields decorated with140 /// parsing attributes similar to a cmdlet class or a141 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.142 ///143 /// The default implementation returns null. (no additional parameters)144 /// </returns>145 object? ClearContentDynamicParameters(string path);146 }147 148 #endregion IContentCmdletProvider149}150 