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 IDynamicPropertyCmdletProvider8 /// <summary>9 /// An interface that can be implemented on a Cmdlet provider to expose the dynamic10 /// manipulation of properties.11 /// </summary>12 /// <remarks>13 /// An IDynamicPropertyCmdletProvider provider implements a set of methods that allows14 /// the use of a set of core commands against the data store that the provider15 /// gives access to. By implementing this interface users can take advantage16 /// the commands that expose the creation and deletion of properties on an item.17 /// rename-itemproperty18 /// remove-itemproperty19 /// new-itemproperty20 /// etc.21 /// This interface should only be implemented on derived classes of22 /// <see cref="CmdletProvider"/>, <see cref="ItemCmdletProvider"/>,23 /// <see cref="ContainerCmdletProvider"/>, or <see cref="NavigationCmdletProvider"/>.24 ///25 /// A Cmdlet provider should implemented this interface if items in the26 /// namespace have dynamic properties the provide wishes to expose.27 /// </remarks>28 public interface IDynamicPropertyCmdletProvider : IPropertyCmdletProvider29 {30 /// <summary>31 /// Creates a new property on the specified item.32 /// </summary>33 /// <param name="path">34 /// The path to the item on which the new property should be created.35 /// </param>36 /// <param name="propertyName">37 /// The name of the property that should be created.38 /// </param>39 /// <param name="propertyTypeName">40 /// The type of the property that should be created.41 /// </param>42 /// <param name="value">43 /// The new value of the property that should be created.44 /// </param>45 /// <returns>46 /// Nothing. The new property that was created should be passed to the WritePropertyObject method.47 /// </returns>48 /// <remarks>49 /// Providers override this method to give the user the ability to add properties to provider objects50 /// using the new-itemproperty cmdlet.51 ///52 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>53 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those54 /// requirements by accessing the appropriate property from the base class.55 ///56 /// By default overrides of this method should not create new properties on objects that are generally hidden from57 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if58 /// the path represents an item that is hidden from the user and Force is set to false.59 /// </remarks>60 void NewProperty(61 string path,62 string propertyName,63 string propertyTypeName,64 object? value);65 66 /// <summary>67 /// Gives the provider an opportunity to attach additional parameters to the68 /// new-itemproperty cmdlet.69 /// </summary>70 /// <param name="path">71 /// If the path was specified on the command line, this is the path72 /// to the item to get the dynamic parameters for.73 /// </param>74 /// <param name="propertyName">75 /// The name of the property that should be created.76 /// </param>77 /// <param name="propertyTypeName">78 /// The type of the property that should be created.79 /// </param>80 /// <param name="value">81 /// The new value of the property that should be created.82 /// </param>83 /// <returns>84 /// Overrides of this method should return an object that has properties and fields decorated with85 /// parsing attributes similar to a cmdlet class or a86 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.87 ///88 /// The default implementation returns null. (no additional parameters)89 /// </returns>90 object? NewPropertyDynamicParameters(91 string path,92 string propertyName,93 string propertyTypeName,94 object? value);95 96 /// <summary>97 /// Removes a property on the item specified by the path.98 /// </summary>99 /// <param name="path">100 /// The path to the item on which the property should be removed.101 /// </param>102 /// <param name="propertyName">103 /// The name of the property to be removed.104 /// </param>105 /// <returns>106 /// Nothing.107 /// </returns>108 /// <remarks>109 /// Providers override this method to give the user the ability to remove properties from provider objects110 /// using the remove-itemproperty cmdlet.111 ///112 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>113 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those114 /// requirements by accessing the appropriate property from the base class.115 ///116 /// By default overrides of this method should not remove properties on objects that are generally hidden from117 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if118 /// the path represents an item that is hidden from the user and Force is set to false.119 /// </remarks>120 void RemoveProperty(121 string path,122 string propertyName);123 124 /// <summary>125 /// Gives the provider an opportunity to attach additional parameters to the126 /// remove-itemproperty cmdlet.127 /// </summary>128 /// <param name="path">129 /// If the path was specified on the command line, this is the path130 /// to the item to get the dynamic parameters for.131 /// </param>132 /// <param name="propertyName">133 /// The name of the property that should be removed.134 /// </param>135 /// <returns>136 /// Overrides of this method should return an object that has properties and fields decorated with137 /// parsing attributes similar to a cmdlet class or a138 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.139 ///140 /// The default implementation returns null. (no additional parameters)141 /// </returns>142 object RemovePropertyDynamicParameters(143 string path,144 string propertyName);145 146 /// <summary>147 /// Renames a property of the item at the specified path.148 /// </summary>149 /// <param name="path">150 /// The path to the item on which to rename the property.151 /// </param>152 /// <param name="sourceProperty">153 /// The property to rename.154 /// </param>155 /// <param name="destinationProperty">156 /// The new name of the property.157 /// </param>158 /// <returns>159 /// Nothing. The new property that was renamed should be passed to the WritePropertyObject method.160 /// </returns>161 /// <remarks>162 /// Providers override this method to give the user the ability to rename properties of provider objects163 /// using the rename-itemproperty cmdlet.164 ///165 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>166 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those167 /// requirements by accessing the appropriate property from the base class.168 ///169 /// By default overrides of this method should not rename properties on objects that are generally hidden from170 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if171 /// the path represents an item that is hidden from the user and Force is set to false.172 /// </remarks>173 void RenameProperty(174 string path,175 string sourceProperty,176 string destinationProperty);177 178 /// <summary>179 /// Gives the provider an opportunity to attach additional parameters to the180 /// rename-itemproperty cmdlet.181 /// </summary>182 /// <param name="path">183 /// If the path was specified on the command line, this is the path184 /// to the item to get the dynamic parameters for.185 /// </param>186 /// <param name="sourceProperty">187 /// The property to rename.188 /// </param>189 /// <param name="destinationProperty">190 /// The new name of the property.191 /// </param>192 /// <returns>193 /// Overrides of this method should return an object that has properties and fields decorated with194 /// parsing attributes similar to a cmdlet class or a195 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.196 ///197 /// The default implementation returns null. (no additional parameters)198 /// </returns>199 object? RenamePropertyDynamicParameters(200 string path,201 string sourceProperty,202 string destinationProperty);203 204 /// <summary>205 /// Copies a property of the item at the specified path to a new property on the206 /// destination item.207 /// </summary>208 /// <param name="sourcePath">209 /// The path to the item on which to copy the property.210 /// </param>211 /// <param name="sourceProperty">212 /// The name of the property to copy.213 /// </param>214 /// <param name="destinationPath">215 /// The path to the item on which to copy the property to.216 /// </param>217 /// <param name="destinationProperty">218 /// The destination property to copy to.219 /// </param>220 /// <returns>221 /// Nothing. The new property that was copied to should be passed to the WritePropertyObject method.222 /// </returns>223 /// <remarks>224 /// Providers override this method to give the user the ability to copy properties of provider objects225 /// using the copy-itemproperty cmdlet.226 ///227 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>228 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those229 /// requirements by accessing the appropriate property from the base class.230 ///231 /// By default overrides of this method should not copy properties from or to objects that are generally hidden from232 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if233 /// the path represents an item that is hidden from the user and Force is set to false.234 /// </remarks>235 void CopyProperty(236 string sourcePath,237 string sourceProperty,238 string destinationPath,239 string destinationProperty);240 241 /// <summary>242 /// Gives the provider an opportunity to attach additional parameters to the243 /// copy-itemproperty cmdlet.244 /// </summary>245 /// <param name="sourcePath">246 /// If the path was specified on the command line, this is the path247 /// to the item to get the dynamic parameters for.248 /// </param>249 /// <param name="sourceProperty">250 /// The name of the property to copy.251 /// </param>252 /// <param name="destinationPath">253 /// The path to the item on which to copy the property to.254 /// </param>255 /// <param name="destinationProperty">256 /// The destination property to copy to.257 /// </param>258 /// <returns>259 /// Overrides of this method should return an object that has properties and fields decorated with260 /// parsing attributes similar to a cmdlet class or a261 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.262 ///263 /// The default implementation returns null. (no additional parameters)264 /// </returns>265 object? CopyPropertyDynamicParameters(266 string sourcePath,267 string sourceProperty,268 string destinationPath,269 string destinationProperty);270 271 /// <summary>272 /// Moves a property on an item specified by the path.273 /// </summary>274 /// <param name="sourcePath">275 /// The path to the item on which to move the property.276 /// </param>277 /// <param name="sourceProperty">278 /// The name of the property to move.279 /// </param>280 /// <param name="destinationPath">281 /// The path to the item on which to move the property to.282 /// </param>283 /// <param name="destinationProperty">284 /// The destination property to move to.285 /// </param>286 /// <returns>287 /// Nothing. The new property that was created should be passed to the WritePropertyObject method.288 /// </returns>289 /// <remarks>290 /// Providers override this method to give the user the ability to move properties from one provider object291 /// to another using the move-itemproperty cmdlet.292 ///293 /// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>294 /// of ExpandWildcards, Filter, Include, or Exclude should ensure that the path passed meets those295 /// requirements by accessing the appropriate property from the base class.296 ///297 /// By default overrides of this method should not move properties on or to objects that are generally hidden from298 /// the user unless the Force property is set to true. An error should be sent to the WriteError method if299 /// the path represents an item that is hidden from the user and Force is set to false.300 /// </remarks>301 void MoveProperty(302 string sourcePath,303 string sourceProperty,304 string destinationPath,305 string destinationProperty);306 307 /// <summary>308 /// Gives the provider an opportunity to attach additional parameters to the309 /// move-itemproperty cmdlet.310 /// </summary>311 /// <param name="sourcePath">312 /// If the path was specified on the command line, this is the path313 /// to the item to get the dynamic parameters for.314 /// </param>315 /// <param name="sourceProperty">316 /// The name of the property to copy.317 /// </param>318 /// <param name="destinationPath">319 /// The path to the item on which to copy the property to.320 /// </param>321 /// <param name="destinationProperty">322 /// The destination property to copy to.323 /// </param>324 /// <returns>325 /// Overrides of this method should return an object that has properties and fields decorated with326 /// parsing attributes similar to a cmdlet class or a327 /// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.328 ///329 /// The default implementation returns null. (no additional parameters)330 /// </returns>331 object? MovePropertyDynamicParameters(332 string sourcePath,333 string sourceProperty,334 string destinationPath,335 string destinationProperty);336 }337 338 #endregion IDynamicPropertyCmdletProvider339}340 