Add OutputType attribute to various commands (#16962)

This commit is contained in:
MartinGC94
2022-03-24 15:54:08 -07:00
committed by GitHub
parent 94eeb8e423
commit 5e6e7ca449
17 changed files with 24 additions and 1 deletions
@@ -1278,6 +1278,7 @@ $result
/// </summary>
[Cmdlet(VerbsCommon.Rename, "Computer", SupportsShouldProcess = true,
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097054", RemotingCapability = RemotingCapability.SupportedByCommand)]
[OutputType(typeof(RenameComputerChangeInfo))]
public class RenameComputerCommand : PSCmdlet
{
#region Private Members
@@ -17,6 +17,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Cmdlet(VerbsCommon.Get, "TimeZone", DefaultParameterSetName = "Name",
HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096904")]
[OutputType(typeof(TimeZoneInfo))]
[Alias("gtz")]
public class GetTimeZoneCommand : PSCmdlet
{
@@ -121,6 +122,7 @@ namespace Microsoft.PowerShell.Commands
SupportsShouldProcess = true,
DefaultParameterSetName = "Name",
HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2097056")]
[OutputType(typeof(TimeZoneInfo))]
[Alias("stz")]
public class SetTimeZoneCommand : PSCmdlet
{
@@ -159,7 +161,7 @@ namespace Microsoft.PowerShell.Commands
#endregion Parameters
/// <summary>
/// Implementation of the ProcessRecord method for Get-TimeZone.
/// Implementation of the ProcessRecord method for Set-TimeZone.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2208:InstantiateArgumentExceptionsCorrectly", Justification = "Since Name is not a parameter of this method, it confuses FXCop. It is the appropriate value for the exception.")]
protected override void ProcessRecord()
@@ -19,6 +19,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Cmdlet(VerbsData.ConvertTo, "Html", DefaultParameterSetName = "Page",
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096595", RemotingCapability = RemotingCapability.None)]
[OutputType(typeof(string))]
public sealed
class ConvertToHtmlCommand : PSCmdlet
{
@@ -17,6 +17,7 @@ namespace Microsoft.PowerShell.Commands
/// This class implements Test-Json command.
/// </summary>
[Cmdlet(VerbsDiagnostic.Test, "Json", DefaultParameterSetName = ParameterAttribute.AllParameterSets, HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096609")]
[OutputType(typeof(bool))]
public class TestJsonCommand : PSCmdlet
{
private const string SchemaFileParameterSet = "SchemaFile";
@@ -374,6 +374,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Cmdlet(VerbsCommon.New, "Variable", SupportsShouldProcess = true, ConfirmImpact = ConfirmImpact.Low,
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097121")]
[OutputType(typeof(PSVariable))]
public sealed class NewVariableCommand : VariableCommandBase
{
#region parameters
@@ -16,6 +16,7 @@ namespace Microsoft.PowerShell.Commands
/// This command converts an object to a Json string representation.
/// </summary>
[Cmdlet(VerbsData.ConvertTo, "Json", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096925", RemotingCapability = RemotingCapability.None)]
[OutputType(typeof(string))]
public class ConvertToJsonCommand : PSCmdlet, IDisposable
{
/// <summary>
@@ -13,6 +13,7 @@ namespace Microsoft.PowerShell.Commands
/// This command makes an HTTP or HTTPS request to a web server and returns the results.
/// </summary>
[Cmdlet(VerbsLifecycle.Invoke, "WebRequest", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097126", DefaultParameterSetName = "StandardMethod")]
[OutputType(typeof(BasicHtmlWebResponseObject))]
public class InvokeWebRequestCommand : WebRequestPSCmdlet
{
#region Virtual Method Overrides
@@ -556,6 +556,7 @@ namespace Microsoft.PowerShell.Commands
[CmdletProvider("Certificate", ProviderCapabilities.ShouldProcess)]
[OutputType(typeof(string), typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.ResolvePath)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PushLocation)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PopLocation)]
[OutputType(typeof(Microsoft.PowerShell.Commands.X509StoreLocation), typeof(X509Certificate2), ProviderCmdlet = ProviderCmdlet.GetItem)]
[OutputType(typeof(X509Store), typeof(X509Certificate2), ProviderCmdlet = ProviderCmdlet.GetChildItem)]
public sealed class CertificateProvider : NavigationCmdletProvider, ICmdletProviderSupportsHelp
@@ -389,6 +389,7 @@ namespace Microsoft.WSMan.Management
/// authentication is achieved via a trusted X509 certificate or Kerberos.
/// </summary>
[Cmdlet(VerbsLifecycle.Enable, "WSManCredSSP", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096719")]
[OutputType(typeof(XmlElement))]
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SSP")]
public class EnableWSManCredSSPCommand : WSManCredSSPCommandBase, IDisposable/*, IDynamicParameters*/
@@ -736,6 +737,7 @@ namespace Microsoft.WSMan.Management
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Cred")]
[SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SSP")]
[Cmdlet(VerbsCommon.Get, "WSManCredSSP", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096838")]
[OutputType(typeof(string))]
public class GetWSManCredSSPCommand : PSCmdlet, IDisposable
{
#region private
@@ -24,6 +24,7 @@ namespace Microsoft.WSMan.Management
/// -SelectorSet {Name=Spooler}
/// </summary>
[Cmdlet(VerbsLifecycle.Invoke, "WSManAction", DefaultParameterSetName = "URI", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096843")]
[OutputType(typeof(XmlElement))]
public class InvokeWSManActionCommand : AuthenticatingWSManCommand, IDisposable
{
/// <summary>
@@ -26,6 +26,7 @@ namespace Microsoft.WSMan.Management
/// Connect-WSMan.
/// </summary>
[Cmdlet(VerbsCommon.New, "WSManSessionOption", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096845")]
[OutputType(typeof(SessionOption))]
public class NewWSManSessionOptionCommand : PSCmdlet
{
/// <summary>
@@ -23,6 +23,7 @@ namespace Microsoft.WSMan.Management
/// service is running.
/// </summary>
[Cmdlet(VerbsDiagnostic.Test, "WSMan", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2097114")]
[OutputType(typeof(XmlElement))]
public class TestWSManCommand : AuthenticatingWSManCommand, IDisposable
{
/// <summary>
@@ -30,6 +30,7 @@ namespace Microsoft.WSMan.Management
/// 4. Enable firewall exception for WS-Management traffic.
/// </summary>
[Cmdlet(VerbsCommon.Set, "WSManQuickConfig", HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2097112")]
[OutputType(typeof(string))]
public class SetWSManQuickConfigCommand : PSCmdlet, IDisposable
{
/// <summary>
@@ -29,6 +29,7 @@ namespace Microsoft.WSMan.Management
/// -SelectorSet {Name=Spooler}
/// </summary>
[Cmdlet(VerbsCommon.Get, "WSManInstance", DefaultParameterSetName = "GetInstance", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096627")]
[OutputType(typeof(XmlElement))]
public class GetWSManInstanceCommand : AuthenticatingWSManCommand, IDisposable
{
#region parameter
@@ -685,6 +686,7 @@ namespace Microsoft.WSMan.Management
/// -SelectorSet {Name=Spooler}
/// </summary>
[Cmdlet(VerbsCommon.Set, "WSManInstance", DefaultParameterSetName = "ComputerName", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096937")]
[OutputType(typeof(XmlElement), typeof(string))]
public class SetWSManInstanceCommand : AuthenticatingWSManCommand, IDisposable
{
#region Parameters
@@ -1324,6 +1326,7 @@ namespace Microsoft.WSMan.Management
/// using specified ValueSet or input File.
/// </summary>
[Cmdlet(VerbsCommon.New, "WSManInstance", DefaultParameterSetName = "ComputerName", HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096933")]
[OutputType(typeof(XmlElement))]
public class NewWSManInstanceCommand : AuthenticatingWSManCommand, IDisposable
{
/// <summary>
@@ -3967,6 +3967,7 @@ namespace System.Management.Automation.Runspaces
#>
[CmdletBinding(DefaultParameterSetName = 'ScriptInputSet')]
[OutputType([System.Management.Automation.CommandCompletion])]
Param(
[Parameter(ParameterSetName = 'ScriptInputSet', Mandatory = $true, Position = 0)]
[string] $inputScript,
@@ -37,6 +37,7 @@ namespace Microsoft.PowerShell.Commands
[OutputType(typeof(FileSecurity), ProviderCmdlet = ProviderCmdlet.SetAcl)]
[OutputType(typeof(string), typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.ResolvePath)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PushLocation)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PopLocation)]
[OutputType(typeof(byte), typeof(string), ProviderCmdlet = ProviderCmdlet.GetContent)]
[OutputType(typeof(FileInfo), ProviderCmdlet = ProviderCmdlet.GetItem)]
[OutputType(typeof(FileInfo), typeof(DirectoryInfo), ProviderCmdlet = ProviderCmdlet.GetChildItem)]
@@ -61,6 +61,9 @@ namespace Microsoft.PowerShell.Commands
[OutputType(typeof(RegistryKey), ProviderCmdlet = ProviderCmdlet.GetItem)]
[OutputType(typeof(RegistryKey), typeof(string), typeof(Int32), typeof(Int64), ProviderCmdlet = ProviderCmdlet.GetItemProperty)]
[OutputType(typeof(RegistryKey), ProviderCmdlet = ProviderCmdlet.NewItem)]
[OutputType(typeof(string), typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.ResolvePath)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PushLocation)]
[OutputType(typeof(PathInfo), ProviderCmdlet = ProviderCmdlet.PopLocation)]
public sealed partial class RegistryProvider :
NavigationCmdletProvider,
IPropertyCmdletProvider,