File size: 9,919 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections.ObjectModel;
#nullable enable
namespace System.Management.Automation.Provider
{
#region IPropertyCmdletProvider
/// <summary>
/// An interface that can be implemented by a Cmdlet provider to expose properties of an item.
/// </summary>
/// <remarks>
/// 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
/// <see cref="CmdletProvider"/>, <see cref="ItemCmdletProvider"/>,
/// <see cref="ContainerCmdletProvider"/>, or <see cref="NavigationCmdletProvider"/>.
///
/// A namespace provider should implemented this interface if items in the
/// namespace have properties the provide wishes to expose.
/// </remarks>
public interface IPropertyCmdletProvider
{
/// <summary>
/// Gets the properties of the item specified by the path.
/// </summary>
/// <param name="path">
/// The path to the item to retrieve properties from.
/// </param>
/// <param name="providerSpecificPickList">
/// A list of properties that should be retrieved. If this parameter is null
/// or empty, all properties should be retrieved.
/// </param>
/// <returns>
/// Nothing. The property that was retrieved should be passed to the WritePropertyObject method.
/// </returns>
/// <remarks>
/// Providers override this method to give the user the ability to add properties to provider objects
/// using the get-itemproperty cmdlet.
///
/// Providers that declare <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>
/// 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 <see cref="System.Management.Automation.PSObject"/> can be used as a property bag for the
/// properties that need to be returned if the <paramref name="providerSpecificPickList"/> contains
/// multiple properties to write.
/// </remarks>
void GetProperty(
string path,
Collection<string>? providerSpecificPickList);
/// <summary>
/// Gives the provider an opportunity to attach additional parameters to the
/// get-itemproperty cmdlet.
/// </summary>
/// <param name="path">
/// If the path was specified on the command line, this is the path
/// to the item to get the dynamic parameters for.
/// </param>
/// <param name="providerSpecificPickList">
/// A list of properties that should be retrieved. If this parameter is null
/// or empty, all properties should be retrieved.
/// </param>
/// <returns>
/// Overrides of this method should return an object that has properties and fields decorated with
/// parsing attributes similar to a cmdlet class or a
/// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.
///
/// The default implementation returns null. (no additional parameters)
/// </returns>
object? GetPropertyDynamicParameters(
string path,
Collection<string>? providerSpecificPickList);
/// <summary>
/// Sets the specified properties of the item at the specified path.
/// </summary>
/// <param name="path">
/// The path to the item to set the properties on.
/// </param>
/// <param name="propertyValue">
/// A PSObject which contains a collection of the name, type, value
/// of the properties to be set.
/// </param>
/// <returns>
/// Nothing. The property that was set should be passed to the WritePropertyObject method.
/// </returns>
/// <remarks>
/// 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 <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>
/// 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 <see cref="System.Management.Automation.PSObject"/> can be used as a property bag for the
/// properties that need to be returned if the <paramref name="providerSpecificPickList"/> contains
/// multiple properties to write.
/// <paramref name="propertyValue"/> is a property bag containing the properties that should be set.
/// See <see cref="System.Management.Automation.PSObject"/> for more information.
/// </remarks>
void SetProperty(
string path,
PSObject propertyValue);
/// <summary>
/// Gives the provider an opportunity to attach additional parameters to the
/// get-itemproperty cmdlet.
/// </summary>
/// <param name="path">
/// If the path was specified on the command line, this is the path
/// to the item to get the dynamic parameters for.
/// </param>
/// <param name="propertyValue">
/// A PSObject which contains a collection of the name, type, value
/// of the properties to be set.
/// </param>
/// <returns>
/// Overrides of this method should return an object that has properties and fields decorated with
/// parsing attributes similar to a cmdlet class or a
/// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.
///
/// The default implementation returns null. (no additional parameters)
/// </returns>
object? SetPropertyDynamicParameters(
string path,
PSObject propertyValue);
/// <summary>
/// Clears a property of the item at the specified path.
/// </summary>
/// <param name="path">
/// The path to the item on which to clear the property.
/// </param>
/// <param name="propertyToClear">
/// The name of the property to clear.
/// </param>
/// <returns>
/// Nothing. The property that was cleared should be passed to the WritePropertyObject method.
/// </returns>
/// <remarks>
/// 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 <see cref="System.Management.Automation.Provider.ProviderCapabilities"/>
/// 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 <see cref="System.Management.Automation.PSObject"/> can be used as a property bag for the
/// properties that need to be returned if the <paramref name="providerSpecificPickList"/> contains
/// multiple properties to write.
/// </remarks>
void ClearProperty(
string path,
Collection<string> propertyToClear);
/// <summary>
/// Gives the provider an opportunity to attach additional parameters to the
/// clear-itemproperty cmdlet.
/// </summary>
/// <param name="path">
/// If the path was specified on the command line, this is the path
/// to the item to get the dynamic parameters for.
/// </param>
/// <param name="propertyToClear">
/// The name of the property to clear.
/// </param>
/// <returns>
/// Overrides of this method should return an object that has properties and fields decorated with
/// parsing attributes similar to a cmdlet class or a
/// <see cref="System.Management.Automation.RuntimeDefinedParameterDictionary"/>.
///
/// The default implementation returns null. (no additional parameters)
/// </returns>
object? ClearPropertyDynamicParameters(
string path,
Collection<string> propertyToClear);
}
#endregion IPropertyCmdletProvider
}
|