Skip to content

Commit 6f26ce8

Browse files
committed
Fix Get-subscription cmdlets
1 parent 9fe082c commit 6f26ce8

File tree

5 files changed

+58
-28
lines changed

5 files changed

+58
-28
lines changed
Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
2-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Management.Automation;
6-
using System.Text;
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
714

815
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
916
{
10-
[Cmdlet("Get", Common.AzureRMConstants.AzureRMPrefix + "SubscriptionDeploymentStack",
11-
DefaultParameterSetName = GetAzSubscriptionDeploymentStack.ListParameterSetname), OutputType(typeof(PSDeploymentStack))]
12-
[Alias("Get-AzDeploymentStack")]
13-
class GetAzSubscriptionDeploymentStack : DeploymentStacksCmdletBase
17+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
18+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Management.Automation;
22+
using System.Text;
23+
24+
[Cmdlet("Get", Common.AzureRMConstants.AzureRMPrefix + "DeploymentStack",
25+
DefaultParameterSetName = GetAzDeploymentStack.ListParameterSetname), OutputType(typeof(PSDeploymentStack))]
26+
[Alias("Get-AzSubscriptionDeploymentStack")]
27+
public class GetAzDeploymentStack : DeploymentStacksCmdletBase
1428
{
1529
#region Cmdlet Parameters and Parameter Set Definitions
1630

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
2-
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
3-
using System;
4-
using System.Collections.Generic;
5-
using System.Management.Automation;
6-
using System.Text;
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
714

815
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
916
{
10-
[Cmdlet("Get", Common.AzureRMConstants.AzureRMPrefix + "SubscriptionDeploymentStackSnapshot",
11-
DefaultParameterSetName = GetAzSubscriptionDeploymentStackSnapshot.ListParameterSetname), OutputType(typeof(PSDeploymentStackSnapshot))]
12-
class GetAzSubscriptionDeploymentStackSnapshot : DeploymentStacksCmdletBase
17+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
18+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Management.Automation;
22+
using System.Text;
23+
24+
[Cmdlet("Get", Common.AzureRMConstants.AzureRMPrefix + "DeploymentStackSnapshot",
25+
DefaultParameterSetName = GetAzDeploymentStackSnapshot.ListParameterSetname), OutputType(typeof(PSDeploymentStackSnapshot))]
26+
[Alias("Get-AzSubscriptionDeploymentStackSnapshot")]
27+
public class GetAzDeploymentStackSnapshot : DeploymentStacksCmdletBase
1328
{
1429
#region Cmdlet Parameters and Parameter Set Definitions
1530

@@ -39,7 +54,7 @@ class GetAzSubscriptionDeploymentStackSnapshot : DeploymentStacksCmdletBase
3954
#endregion
4055

4156
#region Cmdlet Overrides
42-
57+
4358
public override void ExecuteCmdlet()
4459
{
4560
try
@@ -69,5 +84,6 @@ public override void ExecuteCmdlet()
6984
}
7085

7186
#endregion
87+
7288
}
7389
}

src/Resources/ResourceManager/SdkModels/DeploymentStacks/PSDeploymentStack.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ internal PSDeploymentStack(DeploymentStack deploymentStack)
5656
this.id = deploymentStack.Id;
5757
this.name = deploymentStack.Name;
5858
this.type = deploymentStack.Type;
59-
this.creationTime = deploymentStack.SystemData.CreatedAt;
59+
this.creationTime = (deploymentStack.SystemData != null) ? deploymentStack.SystemData.CreatedAt : null;
6060
this.location = deploymentStack.Location;
6161
this.template = deploymentStack.Template;
6262
this.templateLink = deploymentStack.TemplateLink;

src/Resources/Resources.Test/ScenarioTests/DeploymentStackTests.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,4 @@ function Test-GetSubscriptionDeploymentStack
156156
# Cleanup
157157
Clean-DeploymentAtSubscription $rname
158158
}
159-
}
160-
161-
function
159+
}

src/Resources/Resources/Az.Resources.psd1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ CmdletsToExport = 'Get-AzProviderOperation', 'Remove-AzRoleAssignment',
153153
'Get-AzTenantDeploymentWhatIfResult', 'Get-AzTemplateSpec',
154154
'New-AzTemplateSpec', 'Set-AzTemplateSpec', 'Export-AzTemplateSpec',
155155
'Remove-AzTemplateSpec', 'Get-AzResourceGroupDeploymentStack',
156-
'Get-AzResourceGroupDeploymentStackSnapshot', 'Get-AzSubscriptionDeploymentStack',
157-
'Get-AzSubscriptionDeploymentStackSnapshot', 'New-AzResourceGroupDeploymentStack',
156+
'Get-AzResourceGroupDeploymentStackSnapshot',
157+
'New-AzResourceGroupDeploymentStack',
158158
'New-AzSubscriptionDeploymentStack', 'Remove-AzResourceGroupDeploymentStack',
159159
'Remove-AzResourceGroupDeploymentStackSnapshot', 'Remove-AzSubscriptionDeploymentStack',
160160
'Remove-AzSubscriptionDeploymentStackSnapshot', 'Set-AzResourceGroupDeploymentStack',
161-
'Set-AzSubscriptionDeploymentStack'
161+
'Set-AzSubscriptionDeploymentStack', 'Get-AzDeploymentStack', 'Get-AzDeploymentStackSnapshot'
162162

163163
# Variables to export from this module
164164
# VariablesToExport = @()
@@ -174,7 +174,9 @@ AliasesToExport = 'Get-AzResourceProviderAction',
174174
'Stop-AzSubscriptionDeployment',
175175
'Save-AzSubscriptionDeploymentTemplate',
176176
'Get-AzSubscriptionDeploymentOperation',
177-
'Get-AzSubscriptionDeploymentWhatIfResult'
177+
'Get-AzSubscriptionDeploymentWhatIfResult',
178+
'Get-AzSubscriptionDeploymentStack',
179+
'Get-AzSubscriptionDeploymentStackSnapshot'
178180

179181
# DSC resources to export from this module
180182
# DscResourcesToExport = @()

0 commit comments

Comments
 (0)