Skip to content

Application Gateway command-lets #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions setup/azurecmdfiles.wxi
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,9 @@
<Component Id="cmp54514D36BA8821CF1149D4647C9F34BA" Guid="*">
<File Id="fil133B69D4144D718FE7E559FF1AA9673B" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Compute\Microsoft.Azure.Commands.Network.dll" />
</Component>
<Component Id="cmp40C5FD8B583CA05AA7EC5F1FCF0E3E92" Guid="*">
<File Id="fil813CB6FE82DAC50B66F7775533F7CB99" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Compute\Microsoft.Azure.Commands.Network.dll-help.xml" />
</Component>
<Component Id="cmp92D521CCBFF0A4064A70115D4DBE13C4" Guid="*">
<File Id="filF6C9F9970C59B38828F1E813670BCB7F" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Compute\Microsoft.Azure.Commands.Network.format.ps1xml" />
</Component>
Expand Down Expand Up @@ -1411,6 +1414,9 @@
<Component Id="cmp58A842A5ABBE9598F160B1A7783AC260" Guid="*">
<File Id="fil1F921EEB0D64502700FB274014AFE039" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Network\Microsoft.Azure.Commands.Network.dll" />
</Component>
<Component Id="cmp8183D799D86557ABFB78C065A50D9FD0" Guid="*">
<File Id="fil01BC0341E1321B5BA0FAEB442B5F654C" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Network\Microsoft.Azure.Commands.Network.dll-help.xml" />
</Component>
<Component Id="cmpFDA1F5A25A639A882EB28E3221AD7DE9" Guid="*">
<File Id="filD00F4DBD80CA97D9AEA81F8E8D382906" KeyPath="yes" Source="$(var.sourceDir)\ServiceManagement\Azure\Network\Microsoft.Azure.Commands.Network.format.ps1xml" />
</Component>
Expand Down Expand Up @@ -2723,6 +2729,7 @@
<ComponentRef Id="cmpC6750DE6908003A036E7C24FF3978D57" />
<ComponentRef Id="cmp40C1DC009EF95E711F9B291AC3B7156A" />
<ComponentRef Id="cmp54514D36BA8821CF1149D4647C9F34BA" />
<ComponentRef Id="cmp40C5FD8B583CA05AA7EC5F1FCF0E3E92" />
<ComponentRef Id="cmp92D521CCBFF0A4064A70115D4DBE13C4" />
<ComponentRef Id="cmp9DBA37B38077942A2856B006B0D29A0A" />
<ComponentRef Id="cmp0C0FC77DAEF2A45138590D65DCDD21B8" />
Expand Down Expand Up @@ -2909,6 +2916,7 @@
<ComponentRef Id="cmp3ECF10DC0D89D53F9C58C6794E6EABE8" />
<ComponentRef Id="cmpE289BCE74F52452A2522D76B6503B3BC" />
<ComponentRef Id="cmp58A842A5ABBE9598F160B1A7783AC260" />
<ComponentRef Id="cmp8183D799D86557ABFB78C065A50D9FD0" />
<ComponentRef Id="cmpFDA1F5A25A639A882EB28E3221AD7DE9" />
<ComponentRef Id="cmp8450A5374E428359E5093D5FE7CC360F" />
<ComponentRef Id="cmp55E09008CE2E015C4494C6502B515922" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="System.Spatial" version="5.6.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.9.0.0\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.0.0\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="System.Spatial" version="5.6.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network">
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Network.6.1.1\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
</Reference>
<Reference Include="Moq, Version=4.2.1402.2112, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.12.111071459" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="6.1.1" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="System.Spatial" version="5.6.0" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Properties;
using Microsoft.WindowsAzure.Management.Network.Models;

namespace Microsoft.Azure.Commands.Network.ApplicationGateway
{
[Cmdlet(VerbsCommon.Add, "AzureApplicationGatewaySslCertificate"), OutputType(typeof(ApplicationGatewayOperationResponse))]
public class AddApplicationGatewayCertificateCommand : NetworkCmdletBase
{
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Application Gateway Name representing the Application Gateway")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

[Parameter(Position = 1, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Certificate Name")]
[ValidateNotNullOrEmpty]
public string CertificateName { get; set; }

[Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Certificate Password")]
[ValidateNotNullOrEmpty]
public string Password { get; set; }

[Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Path of Certificate File")]
[ValidateNotNullOrEmpty]
public string CertificateFile { get; set; }
public override void ExecuteCmdlet()
{
WriteVerboseWithTimestamp(string.Format(Resources.AddAzureApplicationGatewaySslCertificateBeginOperation, CommandRuntime.ToString()));
var responseObject = Client.AddApplicationGatewayCertificate(Name, CertificateName, Password, CertificateFile);
WriteVerboseWithTimestamp(string.Format(Resources.AddAzureApplicationGatewaySslCertificateCompletedOperation, CommandRuntime.ToString()));

WriteObject(responseObject);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Properties;
using Microsoft.WindowsAzure.Management.Network.Models;
using PowerShellAppGwModel = Microsoft.Azure.Commands.Network.ApplicationGateway.Model;

namespace Microsoft.Azure.Commands.Network.ApplicationGateway
{
[Cmdlet(VerbsCommon.Get, "AzureApplicationGateway"), OutputType(typeof(PowerShellAppGwModel.ApplicationGateway), typeof(IEnumerable<PowerShellAppGwModel.ApplicationGateway>))]
public class GetApplicationGatewayCommand : NetworkCmdletBase
{
[Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Application Gateway Name representing the Application Gateway")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

public override void ExecuteCmdlet()
{
if (!string.IsNullOrEmpty(Name))
{
GetByGatewayName();
}
else
{
GetNoGatewayName();
}
}

private void GetByGatewayName()
{
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayBeginOperation, CommandRuntime.ToString()));
var gateway = Client.GetApplicationGateway(Name);
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayCompletedOperation, CommandRuntime.ToString()));

WriteObject(gateway);
}

private void GetNoGatewayName()
{
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayBeginOperation, CommandRuntime.ToString()));
var gateways = Client.ListApplicationGateway();
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayCompletedOperation, CommandRuntime.ToString()));

WriteObject(gateways, true);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Properties;
using Microsoft.WindowsAzure.Management.Network.Models;
using PowerShellAppGwModel = Microsoft.Azure.Commands.Network.ApplicationGateway.Model;

namespace Microsoft.Azure.Commands.Network.ApplicationGateway
{
[Cmdlet(VerbsCommon.Get, "AzureApplicationGatewayConfig"), OutputType(typeof(PowerShellAppGwModel.ApplicationGatewayConfigContext))]
public class GetApplicationGatewayConfigCommand : NetworkCmdletBase
{
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Application Gateway Name representing the Application Gateway")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

[Parameter(Mandatory = false, HelpMessage = "The file path to save the application gateway configuration to.")]
[ValidateNotNullOrEmpty]
public string ExportToFile { get; set; }

public override void ExecuteCmdlet()
{
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayConfigBeginOperation, CommandRuntime.ToString()));
PowerShellAppGwModel.ApplicationGatewayConfigContext config = Client.GetApplicationGatewayConfig(Name);

if (!string.IsNullOrEmpty(this.ExportToFile))
{
config.ExportToFile(this.ExportToFile);
}

WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewayConfigCompletedOperation, CommandRuntime.ToString()));

WriteObject(config);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------

using System.Collections.Generic;
using System.Management.Automation;
using Microsoft.Azure.Commands.Network.Properties;
using Microsoft.WindowsAzure.Management.Network.Models;
using PowerShellAppGwModel = Microsoft.Azure.Commands.Network.ApplicationGateway.Model;

namespace Microsoft.Azure.Commands.Network.ApplicationGateway
{
[Cmdlet(VerbsCommon.Get, "AzureApplicationGatewaySslCertificate"),
OutputType(typeof(PowerShellAppGwModel.ApplicationGatewayCertificate), typeof(List<PowerShellAppGwModel.ApplicationGatewayCertificate>))]
public class GetApplicationGatewayCertificateCommand : NetworkCmdletBase
{
[Parameter(Position = 0, Mandatory = true, ValueFromPipelineByPropertyName = true,
HelpMessage = "Application Gateway Name representing the Application Gateway")]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

[Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true,
HelpMessage = "Certificate Name")]
[ValidateNotNullOrEmpty]
public string CertificateName { get; set; }

public override void ExecuteCmdlet()
{
if (!string.IsNullOrEmpty(CertificateName))
{
GetByCertificateName();
}
else
{
GetNoCertificateName();
}
}

private void GetByCertificateName()
{
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewaySslCertificateBeginOperation, CommandRuntime.ToString()));
var certificate = Client.GetApplicationGatewayCertificate(Name, CertificateName);
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewaySslCertificateCompletedOperation, CommandRuntime.ToString()));

WriteObject(certificate);
}

private void GetNoCertificateName()
{
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewaySslCertificateBeginOperation, CommandRuntime.ToString()));
var certificates = Client.ListApplicationGatewayCertificate(Name);
WriteVerboseWithTimestamp(string.Format(Resources.GetAzureApplicationGatewaySslCertificateCompletedOperation, CommandRuntime.ToString()));

WriteObject(certificates, true);
}
}
}
Loading