Skip to content

Commit 9ff034a

Browse files
committed
Merge branch 'DeploymentStacks' of https://github.com/Xynoclafe/azure-powershell into DeploymentStacks
2 parents da5af36 + 0414344 commit 9ff034a

File tree

75 files changed

+7269
-7359
lines changed

Some content is hidden

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

75 files changed

+7269
-7359
lines changed

src/Accounts/Accounts/Accounts.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<PsModuleName>Accounts</PsModuleName>
5+
<Configurations>Debug;Release;Powershell</Configurations>
56
</PropertyGroup>
67

78
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />

src/Accounts/Authentication.ResourceManager/Authentication.ResourceManager.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<PsModuleName>Accounts</PsModuleName>
5+
<Configurations>Debug;Release;Powershell</Configurations>
56
</PropertyGroup>
67

78
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />

src/Accounts/Authentication/Authentication.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<PsModuleName>Accounts</PsModuleName>
5+
<Configurations>Debug;Release;Powershell</Configurations>
56
</PropertyGroup>
67

78
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />

src/Accounts/Authenticators/Authenticators.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
99
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
1010
<OutputPath>bin\$(Configuration)</OutputPath>
11+
<Configurations>Debug;Release;Powershell</Configurations>
1112
</PropertyGroup>
1213

1314
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
1415
<DelaySign>false</DelaySign>
1516
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
1617
</PropertyGroup>
1718

19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Powershell|AnyCPU'">
20+
<DelaySign>false</DelaySign>
21+
<DefineConstants>TRACE;DEBUG;NETSTANDARD</DefineConstants>
22+
</PropertyGroup>
23+
1824
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
1925
<SignAssembly>true</SignAssembly>
2026
<DelaySign>true</DelaySign>

src/Monitor/Monitor/Monitor.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<PsModuleName>Monitor</PsModuleName>
5+
<Configurations>Debug;Release;Powershell</Configurations>
56
</PropertyGroup>
67

78
<Import Project="$(MSBuildThisFileDirectory)..\..\Az.props" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
16+
{
17+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
18+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkClient;
19+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
20+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks;
21+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
using Newtonsoft.Json.Linq;
24+
using System;
25+
using System.Management.Automation;
26+
27+
[Cmdlet("Export", Common.AzureRMConstants.AzureRMPrefix + "ManagementGroupDeploymentStackTemplate",
28+
DefaultParameterSetName = ExportByName), OutputType(typeof(PSDeploymentStackTemplateDefinition))]
29+
public class ExportAzManagementGroupDeploymentStackTemplate : DeploymentStacksCmdletBase
30+
{
31+
#region Cmdlet Parameters and Parameter Set Definitions
32+
33+
internal const string ExportByResourceId = "ExportByResourceId";
34+
internal const string ExportByName = "ExportByName";
35+
36+
[Alias("Id")]
37+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByResourceId)]
38+
[ValidateNotNullOrEmpty]
39+
public string ResourceId { get; set; }
40+
41+
[Alias("StackName")]
42+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByName)]
43+
[ValidateNotNullOrEmpty]
44+
public string Name { get; set; }
45+
46+
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByName)]
47+
[ValidateNotNullOrEmpty]
48+
public string ManagementGroupId { get; set; }
49+
50+
#endregion
51+
52+
#region Cmdlet Overrides
53+
protected override void OnProcessRecord()
54+
{
55+
try
56+
{
57+
switch (ParameterSetName)
58+
{
59+
case ExportByResourceId:
60+
WriteObject(DeploymentStacksSdkClient.ExportManagementGroupDeploymentStack(ResourceIdUtility.GetManagementGroupId(ResourceId), ResourceIdUtility.GetDeploymentName(ResourceId)), true);
61+
break;
62+
case ExportByName:
63+
WriteObject(DeploymentStacksSdkClient.ExportManagementGroupDeploymentStack(ManagementGroupId, Name), true);
64+
break;
65+
default:
66+
throw new PSInvalidOperationException();
67+
}
68+
}
69+
catch (Exception ex)
70+
{
71+
WriteExceptionError(ex);
72+
}
73+
}
74+
75+
#endregion
76+
}
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
16+
{
17+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
18+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks;
19+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
20+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
21+
using Newtonsoft.Json.Linq;
22+
using System;
23+
using System.Management.Automation;
24+
25+
[Cmdlet("Export", Common.AzureRMConstants.AzureRMPrefix + "ResourceGroupDeploymentStackTemplate",
26+
DefaultParameterSetName = ExportByName), OutputType(typeof(PSDeploymentStackTemplateDefinition))]
27+
public class ExportAzResourceGroupDeploymentStackTemplate : DeploymentStacksCmdletBase
28+
{
29+
#region Cmdlet Parameters and Parameter Set Definitions
30+
31+
internal const string ExportByResourceId = "ExportByResourceId";
32+
internal const string ExportByName = "ExportByName";
33+
34+
[Alias("Id")]
35+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByResourceId)]
36+
[ValidateNotNullOrEmpty]
37+
public string ResourceId { get; set; }
38+
39+
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByName)]
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceGroupName { get; set; }
42+
43+
[Alias("StackName")]
44+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByName)]
45+
[ValidateNotNullOrEmpty]
46+
public string Name { get; set; }
47+
48+
#endregion
49+
50+
#region Cmdlet Overrides
51+
52+
protected override void OnProcessRecord()
53+
{
54+
try
55+
{
56+
switch (ParameterSetName)
57+
{
58+
case ExportByResourceId:
59+
WriteObject(DeploymentStacksSdkClient.ExportResourceGroupDeploymentStack(ResourceIdUtility.GetResourceGroupName(ResourceId), ResourceIdUtility.GetDeploymentName(ResourceId)), true);
60+
break;
61+
case ExportByName:
62+
WriteObject(DeploymentStacksSdkClient.ExportResourceGroupDeploymentStack(ResourceGroupName, Name), true);
63+
break;
64+
default:
65+
throw new PSInvalidOperationException();
66+
}
67+
}
68+
catch (Exception ex)
69+
{
70+
WriteExceptionError(ex);
71+
}
72+
}
73+
74+
#endregion
75+
}
76+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
16+
{
17+
18+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Components;
19+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels;
20+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.DeploymentStacks;
21+
using Microsoft.Azure.Commands.ResourceManager.Cmdlets.Utilities;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
using Newtonsoft.Json;
24+
using Newtonsoft.Json.Linq;
25+
using System;
26+
using System.Management.Automation;
27+
28+
[Cmdlet("Export", Common.AzureRMConstants.AzureRMPrefix + "SubscriptionDeploymentStackTemplate",
29+
DefaultParameterSetName = ExportByName), OutputType(typeof(PSDeploymentStackTemplateDefinition))]
30+
public class ExportAzSubscriptionDeploymentStackTemplate : DeploymentStacksCmdletBase
31+
{
32+
#region Cmdlet Parameters and Parameter Set Definitions
33+
34+
internal const string ExportByResourceId = "ExportByResourceId";
35+
internal const string ExportByName = "ExportByName";
36+
37+
[Alias("Id")]
38+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByResourceId)]
39+
[ValidateNotNullOrEmpty]
40+
public string ResourceId { get; set; }
41+
42+
[Alias("StackName")]
43+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ExportByName)]
44+
[ValidateNotNullOrEmpty]
45+
public string Name { get; set; }
46+
47+
#endregion
48+
49+
#region Cmdlet Overrides
50+
protected override void OnProcessRecord()
51+
{
52+
try
53+
{
54+
switch (ParameterSetName)
55+
{
56+
case ExportByResourceId:
57+
WriteObject(DeploymentStacksSdkClient.ExportSubscriptionDeploymentStack(ResourceIdUtility.GetResourceGroupName(ResourceId)), true);
58+
break;
59+
case ExportByName:
60+
WriteObject(DeploymentStacksSdkClient.ExportSubscriptionDeploymentStack(Name), true);
61+
break;
62+
default:
63+
throw new PSInvalidOperationException();
64+
}
65+
}
66+
catch (Exception ex)
67+
{
68+
WriteExceptionError(ex);
69+
}
70+
}
71+
72+
#endregion
73+
}
74+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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+
// ----------------------------------------------------------------------------------
14+
15+
namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
16+
{
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 + "ManagementGroupDeploymentStack",
25+
DefaultParameterSetName = GetAzManagementGroupDeploymentStack.ListDeploymentStacksByManagementGroupId), OutputType(typeof(PSDeploymentStack))]
26+
public class GetAzManagementGroupDeploymentStack : DeploymentStacksCmdletBase
27+
{
28+
#region Cmdlet Parameters and Parameter Set Definitions
29+
30+
internal const string GetDeploymentStackByResourceId = "GetDeploymentStackByResourceId";
31+
internal const string GetDeploymentStackByManagementGroupIdAndStackName = " GetDeploymentStackByManagementGroupIdAndStackName";
32+
internal const string ListDeploymentStacksByManagementGroupId = "ListDeploymentStacksByManagmentGroupId";
33+
34+
[Alias("StackName")]
35+
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = GetDeploymentStackByManagementGroupIdAndStackName,
36+
HelpMessage = "The name of the deploymentStack to get")]
37+
[ValidateNotNullOrEmpty]
38+
public string Name { get; set; }
39+
40+
[Alias("Id")]
41+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = GetDeploymentStackByResourceId,
42+
HelpMessage = "ResourceId of the stack to get")]
43+
[ValidateNotNullOrEmpty]
44+
public string ResourceId { get; set; }
45+
46+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ListDeploymentStacksByManagementGroupId)]
47+
[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = GetDeploymentStackByManagementGroupIdAndStackName)]
48+
[ValidateNotNullOrEmpty]
49+
public string ManagementGroupId { get; set; }
50+
51+
#endregion
52+
53+
#region Cmdlet Overrides
54+
55+
protected override void OnProcessRecord()
56+
{
57+
try
58+
{
59+
this.GetResourcesClient();
60+
switch (ParameterSetName)
61+
{
62+
case GetDeploymentStackByResourceId:
63+
WriteObject(DeploymentStacksSdkClient.GetManagementGroupDeploymentStack(ResourceIdUtility.GetManagementGroupId(ResourceId),
64+
ResourceIdUtility.GetResourceName(ResourceId)), true);
65+
break;
66+
case GetDeploymentStackByManagementGroupIdAndStackName:
67+
WriteObject(DeploymentStacksSdkClient.GetManagementGroupDeploymentStack(ManagementGroupId, Name, true));
68+
break;
69+
case ListDeploymentStacksByManagementGroupId:
70+
WriteObject(DeploymentStacksSdkClient.ListManagementGroupDeploymentStack(ManagementGroupId), true);
71+
break;
72+
default:
73+
throw new PSInvalidOperationException();
74+
}
75+
}
76+
catch (Exception ex)
77+
{
78+
WriteExceptionError(ex);
79+
}
80+
}
81+
82+
#endregion
83+
}
84+
}

src/Resources/ResourceManager/Implementation/DeploymentStacks/GetAzResourceGroupDeploymentStack.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ namespace Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation
2525
DefaultParameterSetName = GetAzResourceGroupDeploymentStack.ListByResourceGroupNameParameterSetName), OutputType(typeof(PSDeploymentStack))]
2626
public class GetAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
2727
{
28+
29+
#region Cmdlet Parameters and Parameter Set Definitions
30+
2831
internal const string GetByResourceIdParameterSetName = "GetDeploymentStackByResourceId";
2932
internal const string ListByResourceGroupNameParameterSetName = "ListDeploymentStacksByResourceGroupName";
3033
internal const string GetByDeploymentStackName = "GetDeploymentStackByStackName";
@@ -44,6 +47,9 @@ public class GetAzResourceGroupDeploymentStack : DeploymentStacksCmdletBase
4447
[ValidateNotNullOrEmpty]
4548
public string Name { get; set; }
4649

50+
#endregion
51+
52+
#region Cmdlet Overrides
4753
protected override void OnProcessRecord()
4854
{
4955
try
@@ -69,9 +75,6 @@ protected override void OnProcessRecord()
6975
}
7076

7177
}
72-
73-
74-
75-
78+
#endregion
7679
}
7780
}

0 commit comments

Comments
 (0)