Skip to content

Commit

Permalink
Merge pull request #62 from Azure/dev
Browse files Browse the repository at this point in the history
.
  • Loading branch information
huangpf committed Aug 2, 2015
2 parents 3a747ed + 894bbb4 commit baf4e41
Show file tree
Hide file tree
Showing 104 changed files with 9,928 additions and 1,210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.3.1\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Storage">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Storage.5.1.1\lib\net40\Microsoft.WindowsAzure.Management.Storage.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.Common.Test/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.2.0-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.3.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
Expand Down
5 changes: 3 additions & 2 deletions src/Common/Commands.ScenarioTest/Commands.ScenarioTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@
<Reference Include="Microsoft.WindowsAzure.Management">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=12.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.3.1\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Network, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.WindowsAzure.Management.Network.7.0.0\lib\net40\Microsoft.WindowsAzure.Management.Network.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Commands.ScenarioTest/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.2.0-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.3.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Network" version="7.0.0" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.WebSites" version="4.4.2-prerelease" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=12.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.3.1\lib\net40\Microsoft.WindowsAzure.Management.Compute.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 @@ -15,7 +15,7 @@
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.14.201151115" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.2.0-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.3.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
</Reference>
<Reference Include="Microsoft.WindowsAzure.Management.Compute, Version=12.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.2.0-preview\lib\net40\Microsoft.WindowsAzure.Management.Compute.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.Compute.12.3.1\lib\net40\Microsoft.WindowsAzure.Management.Compute.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 @@ -15,7 +15,7 @@
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.14.201151115" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.2.0-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="12.3.1" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="5.1.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Common.Authentication;
using Microsoft.Azure.Common.Authentication.Models;
using Microsoft.Azure.Commands.Compute.Common;
using Microsoft.Azure.Commands.Compute.Models;
Expand Down Expand Up @@ -208,14 +209,7 @@ public override void ExecuteCmdlet()
Hashtable publicSettings = new Hashtable();
publicSettings.Add(commandToExecuteKey, commandToExecute ?? "");
publicSettings.Add(fileUrisKey, FileUri ?? new string[] { });

Hashtable privateSettings = new Hashtable();
privateSettings.Add(storageAccountNameKey, StorageAccountName ?? "");
privateSettings.Add(storageAccountKeyKey, StorageAccountKey ?? "");

var SettingString = JsonConvert.SerializeObject(publicSettings);
var ProtectedSettingString = JsonConvert.SerializeObject(privateSettings);


var parameters = new VirtualMachineExtension
{
Expand All @@ -226,7 +220,7 @@ public override void ExecuteCmdlet()
ExtensionType = VirtualMachineCustomScriptExtensionContext.ExtensionDefaultName,
TypeHandlerVersion = (this.TypeHandlerVersion) ?? VirtualMachineCustomScriptExtensionContext.ExtensionDefaultVersion,
Settings = SettingString,
ProtectedSettings = ProtectedSettingString,
ProtectedSettings = GetPrivateConfiguration(),
};

var op = this.VirtualMachineExtensionClient.CreateOrUpdate(
Expand Down Expand Up @@ -292,5 +286,19 @@ protected string GetSasUrlStr(string storageName, string storageKey, string cont
return cloudBlob.Uri + sasToken;
}

protected string GetPrivateConfiguration()
{
if (string.IsNullOrEmpty(this.StorageAccountName) || string.IsNullOrEmpty(this.StorageAccountKey))
{
return string.Empty;
}
else
{
var privateSettings = new Hashtable();
privateSettings.Add(storageAccountNameKey, StorageAccountName);
privateSettings.Add(storageAccountKeyKey, StorageAccountKey);
return JsonUtilities.TryFormatJson(JsonConvert.SerializeObject(privateSettings));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ function Test-ApplicationGatewayCRUD
$poolSetting = New-AzureApplicationGatewayBackendHttpSettings -Name $poolSettingName -Port 80 -Protocol HTTP -CookieBasedAffinity Disabled
$fp = New-AzureApplicationGatewayFrontendPort -Name $frontendPortName -Port 80
$fipconfig = New-AzureApplicationGatewayFrontendIPConfig -Name $fipconfigName -PublicIPAddress $publicip
$listener = New-AzureApplicationGatewayHttpListener -Name $listenerName -Protocol http -FrontendIpConfiguration $fipconfig -FrontendPort $fp
$listener = New-AzureApplicationGatewayHttpListener -Name $listenerName -Protocol http -FrontendIPConfiguration $fipconfig -FrontendPort $fp
$rule = New-AzureApplicationGatewayRequestRoutingRule -Name $ruleName -RuleType basic -BackendHttpSettings $poolSetting -HttpListener $listener -BackendAddressPool $pool
$sku = New-AzureApplicationGatewaySku -Name Standard_Small -Tier Standard -Capacity 2

# $actual = New-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Location $location -BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp -HttpListeners $listener -RequestRoutingRules $rule -Sku $sku
# $expected = Get-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname
# Compare-AzureApplicationGateway $actual $expected
$actual = New-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Location $location -BackendAddressPools $pool -BackendHttpSettingsCollection $poolSetting -FrontendIpConfigurations $fipconfig -GatewayIpConfigurations $gipconfig -FrontendPorts $fp -HttpListeners $listener -RequestRoutingRules $rule -Sku $sku
$expected = Get-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname
Compare-AzureApplicationGateway $actual $expected

# Stop-AzureApplicationGateway -ApplicationGateway $expected
# Remove-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname
Stop-AzureApplicationGateway -ApplicationGateway $expected
Remove-AzureApplicationGateway -Name $appgwName -ResourceGroupName $rgname -Force
}
finally
{
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,7 @@ public override void ExecuteCmdlet()
throw new ArgumentException("Backend address pool with the specified name already exists");
}

backendAddressPool = new PSApplicationGatewayBackendAddressPool();

backendAddressPool.Name = this.Name;

if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId))
{
backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List<PSResourceId>();
foreach (string id in this.BackendIPConfigurationIds)
{
var backendIpConfig = new PSResourceId();
backendIpConfig.Id = id;
backendAddressPool.BackendIpConfigurations.Add(backendIpConfig);
}
}
else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP))
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string ip in this.BackendIPAddresses)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.IpAddress = ip;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}
else
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string fqdn in this.BackendFqdns)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.Fqdn = fqdn;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}

backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName,
this.Name);

backendAddressPool = base.NewObject();
this.ApplicationGateway.BackendAddressPools.Add(backendAddressPool);

WriteObject(this.ApplicationGateway);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,51 @@ public class AzureApplicationGatewayBackendAddressPoolBase : NetworkBaseCmdlet
ParameterSetName = "SetByFqdn",
HelpMessage = "FQDNs of application gateway backend servers")]
[ValidateNotNullOrEmpty]
public List<string> BackendFqdns { get; set; }
public override void ExecuteCmdlet()
public List<string> BackendFqdns { get; set; }

public PSApplicationGatewayBackendAddressPool NewObject()
{
base.ExecuteCmdlet();
var backendAddressPool = new PSApplicationGatewayBackendAddressPool();

backendAddressPool.Name = this.Name;

if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId))
{
backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List<PSResourceId>();
foreach (string id in this.BackendIPConfigurationIds)
{
var backendIpConfig = new PSResourceId();
backendIpConfig.Id = id;
backendAddressPool.BackendIpConfigurations.Add(backendIpConfig);
}
}
else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP))
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string ip in this.BackendIPAddresses)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.IpAddress = ip;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}
else
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string fqdn in this.BackendFqdns)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.Fqdn = fqdn;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}

backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName,
this.Name);

return backendAddressPool;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,7 @@ public class NewAzureApplicationGatewayBackendAddressPoolCommand : AzureApplicat
public override void ExecuteCmdlet()
{
base.ExecuteCmdlet();

var backendAddressPool = new PSApplicationGatewayBackendAddressPool();

backendAddressPool.Name = this.Name;

if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByResourceId))
{
backendAddressPool.BackendIpConfigurations = new System.Collections.Generic.List<PSResourceId>();
foreach (string id in this.BackendIPConfigurationIds)
{
var backendIpConfig = new PSResourceId();
backendIpConfig.Id = id;
backendAddressPool.BackendIpConfigurations.Add(backendIpConfig);
}
}
else if (string.Equals(ParameterSetName, Microsoft.Azure.Commands.Network.Properties.Resources.SetByIP))
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string ip in this.BackendIPAddresses)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.IpAddress = ip;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}
else
{
backendAddressPool.BackendAddresses = new System.Collections.Generic.List<PSApplicationGatewayBackendAddress>();
foreach (string fqdn in this.BackendFqdns)
{
var backendAddress = new PSApplicationGatewayBackendAddress();
backendAddress.Fqdn = fqdn;
backendAddressPool.BackendAddresses.Add(backendAddress);
}
}

backendAddressPool.Id = ApplicationGatewayChildResourceHelper.GetResourceNotSetId(
this.NetworkClient.NetworkResourceProviderClient.Credentials.SubscriptionId,
Microsoft.Azure.Commands.Network.Properties.Resources.ApplicationGatewayBackendAddressPoolName,
this.Name);

WriteObject(backendAddressPool);
WriteObject(base.NewObject());
}
}
}
Loading

0 comments on commit baf4e41

Please sign in to comment.