Skip to content

Commit 674bbd2

Browse files
committed
Add obsolete warnings to PowerShell commands
1 parent 0d84d66 commit 674bbd2

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<PackageVersion Include="Particular.Approvals" Version="2.0.1" />
6161
<PackageVersion Include="Particular.Licensing.Sources" Version="6.1.0" />
6262
<PackageVersion Include="Particular.LicensingComponent.Report" Version="1.0.0" />
63+
<PackageVersion Include="Particular.Obsoletes" Version="1.0.0" />
6364
<PackageVersion Include="Polly.Core" Version="8.5.2" />
6465
<PackageVersion Include="PropertyChanged.Fody" Version="4.1.0" />
6566
<PackageVersion Include="PropertyChanging.Fody" Version="1.30.3" />

src/ServiceControl.Management.PowerShell/Cmdlets/UrlAcls/AddUrlAcl.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http add urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http add urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Add, "UrlAcl")]
610
public class AddUrlAcl : PSCmdlet
711
{
812
[ValidateNotNullOrEmpty]
913
[Parameter(Mandatory = true, Position = 0, HelpMessage = "The URL to add to the URLACL list. This should always in a trailing /")]
1014
public string Url { get; set; }
1115

12-
protected override void ProcessRecord()
13-
{
14-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http add urlacl' command instead.");
15-
}
16-
1716
[ValidateNotNullOrEmpty]
1817
[Parameter(Mandatory = true, Position = 1, HelpMessage = "The user or group to assign to this URLACL")]
1918
public string[] Users;
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http show urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http show urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Get, "UrlAcls")]
6-
public class GetUrlAcls : PSCmdlet
7-
{
8-
protected override void ProcessRecord()
9-
{
10-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http show urlacl' command instead.");
11-
}
12-
}
10+
public class GetUrlAcls : PSCmdlet;
1311
}
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
namespace ServiceControl.Management.PowerShell
22
{
3+
using System;
34
using System.Management.Automation;
5+
using Particular.Obsoletes;
46

7+
[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http delete urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
8+
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http delete urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
59
[Cmdlet(VerbsCommon.Remove, "UrlAcl")]
6-
public class RemoveUrlAcl : PSCmdlet
7-
{
8-
protected override void ProcessRecord()
9-
{
10-
WriteWarning("ServiceControl no longer requires URL reservations, so this command no longer functions. Use the 'netsh http delete urlacl' command instead.");
11-
}
12-
}
10+
public class RemoveUrlAcl : PSCmdlet;
1311
}

src/ServiceControl.Management.PowerShell/ServiceControl.Management.PowerShell.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<PackageReference Include="System.Management.Automation" />
3131
</ItemGroup>
3232

33+
<ItemGroup>
34+
<PackageReference Include="Particular.Obsoletes" PrivateAssets="All" ExcludeAssets="runtime" />
35+
</ItemGroup>
36+
3337
<ItemGroup>
3438
<Artifact Include="$(OutputPath)" DestinationFolder="$(PowerShellModuleArtifactsPath)" />
3539
<Artifact Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\Microsoft.Extensions.DependencyModel.dll" DestinationFolder="$(PowerShellModuleArtifactsPath)" />

0 commit comments

Comments
 (0)