Skip to content

Commit 1cfab69

Browse files
Xynoclafeisra-fel
andauthored
Breaking Change - Removed ApiVersion parameter from Az.Resources deployments cmdlets and changed the output type of Get-AzResourceGroupDeploymentOperations (#13112)
* Remove ApiVersion Parameter from deployments * update changelog * Delete ApiVersion param * Switch to SDK use in ResourceGroup Deployments cmdlets * Include review fixes * Changed help file to reflect new output type * Rollback breaking changes from PR #12141 * Change Get-AzResourceGroupDeploymentOperation implementation to use SDK * Update help * Rollback changes to help files of untouched cmdlets * Suppress breaking change issues * remove subscriptionId param * Update breakingchanges csv * Suppress breaking changes * Review fixes + breaking change suppression * Add missed breaking change issue to fix static analysis failure * Update ChangeLog.md Co-authored-by: Yeming Liu <[email protected]>
1 parent d54017c commit 1cfab69

File tree

67 files changed

+1862
-3984
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1862
-3984
lines changed

src/Resources/ResourceManager/Implementation/CmdletBase/ResourceManagerCmdletBase.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2525
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.RestClients;
2626
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient;
2727
using Microsoft.Rest.Azure;
28-
using Microsoft.WindowsAzure.Commands.Common.CustomAttributes;
2928
using Newtonsoft.Json.Linq;
3029
using System;
3130
using System.Collections.Generic;
3231
using System.Linq;
3332
using System.Management.Automation;
3433
using System.Runtime.ExceptionServices;
3534
using System.Threading;
36-
using System.Threading.Tasks;
3735

3836
/// <summary>
3937
/// The base class for resource manager cmdlets.
@@ -66,14 +64,6 @@ protected CancellationToken? CancellationToken
6664
/// </summary>
6765
private SubscriptionSdkClient subscriptionSdkClient;
6866

69-
/// <summary>
70-
/// Gets or sets the API version.
71-
/// </summary>
72-
[CmdletParameterBreakingChange("ApiVersion", ChangeDescription = "Parameter is being deprecated without being replaced")]
73-
[Parameter(Mandatory = false, HelpMessage = "When set, indicates the version of the resource provider API to use. If not specified, the API version is automatically determined as the latest available.")]
74-
[ValidateNotNullOrEmpty]
75-
public virtual string ApiVersion { get; set; }
76-
7767
/// <summary>
7868
/// Gets or sets the switch that indicates if pre-release API version should be considered.
7969
/// </summary>
@@ -223,42 +213,6 @@ protected virtual void OnStopProcessing()
223213
// no-op
224214
}
225215

226-
/// <summary>
227-
/// Determines the API version.
228-
/// </summary>
229-
/// <param name="resourceId">The resource Id.</param>
230-
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
231-
protected Task<string> DetermineApiVersion(string resourceId, bool? pre = null)
232-
{
233-
return string.IsNullOrWhiteSpace(this.ApiVersion)
234-
? ApiVersionHelper.DetermineApiVersion(
235-
context: DefaultContext,
236-
resourceId: resourceId,
237-
cancellationToken: this.CancellationToken.Value,
238-
pre: pre ?? this.Pre,
239-
cmdletHeaderValues: this.GetCmdletHeaders())
240-
: Task.FromResult(this.ApiVersion);
241-
}
242-
243-
/// <summary>
244-
/// Determines the API version.
245-
/// </summary>
246-
/// <param name="providerNamespace">The provider namespace.</param>
247-
/// <param name="resourceType">The resource type.</param>
248-
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
249-
protected Task<string> DetermineApiVersion(string providerNamespace, string resourceType, bool? pre = null)
250-
{
251-
return string.IsNullOrWhiteSpace(this.ApiVersion)
252-
? ApiVersionHelper.DetermineApiVersion(
253-
DefaultContext,
254-
providerNamespace: providerNamespace,
255-
resourceType: resourceType,
256-
cancellationToken: this.CancellationToken.Value,
257-
pre: pre ?? this.Pre,
258-
cmdletHeaderValues: this.GetCmdletHeaders())
259-
: Task.FromResult(this.ApiVersion);
260-
}
261-
262216
/// <summary>
263217
/// Gets a new instance of the <see cref="ResourceManagerRestRestClient"/>.
264218
/// </summary>

src/Resources/ResourceManager/Implementation/CmdletBase/ResourceManagerCmdletBaseWithAPiVersion.cs

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,63 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using System.Management.Automation;
16+
using System.Threading.Tasks;
17+
using System.Collections.Generic;
1618

1719
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
1820
{
19-
public abstract class ResourceManagerCmdletBaseWithAPiVersion : ResourceManagerCmdletBase
21+
public abstract class ResourceManagerCmdletBaseWithApiVersion : ResourceManagerCmdletBase
2022
{
2123
/// <summary>
2224
/// Gets or sets the API version.
2325
/// </summary>
2426
[Parameter(Mandatory = false, HelpMessage = "When set, indicates the version of the resource provider API to use. If not specified, the API version is automatically determined as the latest available.")]
2527
[ValidateNotNullOrEmpty]
26-
public override string ApiVersion { get; set; }
28+
public string ApiVersion { get; set; }
29+
30+
private Dictionary<string, string> GetCmdletHeaders()
31+
{
32+
return new Dictionary<string, string>
33+
{
34+
{"ParameterSetName", this.ParameterSetName },
35+
{"CommandName", this.CommandRuntime.ToString() }
36+
};
37+
}
38+
39+
/// <summary>
40+
/// Determines the API version.
41+
/// </summary>
42+
/// <param name="resourceId">The resource Id.</param>
43+
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
44+
protected Task<string> DetermineApiVersion(string resourceId, bool? pre = null)
45+
{
46+
return string.IsNullOrWhiteSpace(this.ApiVersion)
47+
? Components.ApiVersionHelper.DetermineApiVersion(
48+
context: DefaultContext,
49+
resourceId: resourceId,
50+
cancellationToken: this.CancellationToken.Value,
51+
pre: pre ?? this.Pre,
52+
cmdletHeaderValues: this.GetCmdletHeaders())
53+
: Task.FromResult(this.ApiVersion);
54+
}
55+
56+
/// <summary>
57+
/// Determines the API version.
58+
/// </summary>
59+
/// <param name="providerNamespace">The provider namespace.</param>
60+
/// <param name="resourceType">The resource type.</param>
61+
/// <param name="pre">When specified, indicates if pre-release API versions should be considered.</param>
62+
protected Task<string> DetermineApiVersion(string providerNamespace, string resourceType, bool? pre = null)
63+
{
64+
return string.IsNullOrWhiteSpace(this.ApiVersion)
65+
? Components.ApiVersionHelper.DetermineApiVersion(
66+
DefaultContext,
67+
providerNamespace: providerNamespace,
68+
resourceType: resourceType,
69+
cancellationToken: this.CancellationToken.Value,
70+
pre: pre ?? this.Pre,
71+
cmdletHeaderValues: this.GetCmdletHeaders())
72+
: Task.FromResult(this.ApiVersion);
73+
}
2774
}
2875
}

src/Resources/ResourceManager/Implementation/CmdletBase/ResourceManipulationCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2323
/// <summary>
2424
/// The base class for manipulating resources.
2525
/// </summary>
26-
public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBaseWithAPiVersion
26+
public abstract class ResourceManipulationCmdletBase : ResourceManagerCmdletBaseWithApiVersion
2727
{
2828
/// <summary>
2929
/// The subscription level parameter set.

src/Resources/ResourceManager/Implementation/Locations/GetAzureLocationCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2828
/// Get all locations with the supported providers.
2929
/// </summary>
3030
[Cmdlet(VerbsCommon.Get, ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "Location"), OutputType(typeof(PSResourceProviderLocation))]
31-
public class GetAzureLocationCmdlet : ResourceManagerCmdletBaseWithAPiVersion
31+
public class GetAzureLocationCmdlet : ResourceManagerCmdletBaseWithApiVersion
3232
{
3333
/// <summary>
3434
/// Executes the cmdlet

src/Resources/ResourceManager/Implementation/Lock/ResourceLockManagementCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2626
/// <summary>
2727
/// Base class for resource lock management cmdlets.
2828
/// </summary>
29-
public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBaseWithAPiVersion
29+
public abstract class ResourceLockManagementCmdletBase : ResourceManagerCmdletBaseWithApiVersion
3030
{
3131
/// <summary>
3232
/// The Id parameter set.

src/Resources/ResourceManager/Implementation/ManagedApplications/ManagedApplicationCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
3232
/// <summary>
3333
/// Base class for policy assignment cmdlets.
3434
/// </summary>
35-
public abstract class ManagedApplicationCmdletBase : ResourceManagerCmdletBaseWithAPiVersion
35+
public abstract class ManagedApplicationCmdletBase : ResourceManagerCmdletBaseWithApiVersion
3636
{
3737
/// <summary>
3838
/// Gets the next set of resources using the <paramref name="nextLink"/>

src/Resources/ResourceManager/Implementation/Policy/GetAzurePolicyAliasCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2727
/// Get an existing resource.
2828
/// </summary>
2929
[Cmdlet(VerbsCommon.Get, AzureRMConstants.AzureRMPrefix + "PolicyAlias"), OutputType(typeof(PsResourceProviderAlias))]
30-
public class GetAzurePolicyAlias : ResourceManagerCmdletBaseWithAPiVersion
30+
public class GetAzurePolicyAlias : ResourceManagerCmdletBaseWithApiVersion
3131
{
3232
/// <summary>
3333
/// Gets or sets the provider namespace match string

src/Resources/ResourceManager/Implementation/Policy/PolicyCmdletBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
3232
/// <summary>
3333
/// Base class for policy cmdlets.
3434
/// </summary>
35-
public abstract class PolicyCmdletBase : ResourceManagerCmdletBaseWithAPiVersion
35+
public abstract class PolicyCmdletBase : ResourceManagerCmdletBaseWithApiVersion
3636
{
3737
public enum ListFilter
3838
{

src/Resources/ResourceManager/Implementation/Providers/GetAzureProviderCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2929
/// Get an existing resource.
3030
/// </summary>
3131
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ResourceProvider", DefaultParameterSetName = GetAzureProviderCmdlet.ListAvailableParameterSet), OutputType(typeof(PSResourceProvider))]
32-
public class GetAzureProviderCmdlet : ResourceManagerCmdletBaseWithAPiVersion
32+
public class GetAzureProviderCmdlet : ResourceManagerCmdletBaseWithApiVersion
3333
{
3434
/// <summary>
3535
/// The individual provider parameter set name

src/Resources/ResourceManager/Implementation/Providers/RegisterAzureProviderCmdlet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2424
/// Register the previewed features of a certain azure resource provider.
2525
/// </summary>
2626
[Cmdlet("Register", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "ResourceProvider", SupportsShouldProcess = true), OutputType(typeof(PSResourceProvider))]
27-
public class RegisterAzureProviderCmdlet : ResourceManagerCmdletBaseWithAPiVersion
27+
public class RegisterAzureProviderCmdlet : ResourceManagerCmdletBaseWithApiVersion
2828
{
2929
/// <summary>
3030
/// Gets or sets the provider namespace

0 commit comments

Comments
 (0)