Skip to content

Commit 475ebc2

Browse files
author
Hovsep
committed
Merge pull request #112 from t-alguer/build_dev
Some bug fixing before the release
2 parents 9a7831e + 61d7a99 commit 475ebc2

File tree

11 files changed

+569
-13
lines changed

11 files changed

+569
-13
lines changed

setup/azurecmdfiles.wxi

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,38 @@
13061306
<File Id="fil658EB945BB104A3BB6E54EB9D7CC76AE" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Tags\System.Spatial.dll" />
13071307
</Component>
13081308
</Directory>
1309+
<Directory Id="dirD9530EC10CD28141F082E5C4FD29B000" Name="TrafficManager">
1310+
<Component Id="cmp77866191B1413E61D7B880F54093D6E9" Guid="*">
1311+
<File Id="fil47028FDF13A3C62054C9F61D64B81C1B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Hyak.Common.dll" />
1312+
</Component>
1313+
<Component Id="cmp7F18AD3C425F41CE8DB8E07CE509DAEA" Guid="*">
1314+
<File Id="fil5FF694D6373108F299202DD982297B14" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.Azure.Commands.TrafficManager.dll" />
1315+
</Component>
1316+
<Component Id="cmp0A1CE29CE32BA5CB7B808FB79F598545" Guid="*">
1317+
<File Id="fil59A6C3AA449C5C5C0ECE64549427DA2B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.Azure.Commands.TrafficManager.dll-help.xml" />
1318+
</Component>
1319+
<Component Id="cmpD2BE076C47F8E3FBE7F08523A849CE97" Guid="*">
1320+
<File Id="filE0F844EEB58C5CD073B9E55FD8EE0F3B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.Azure.Common.Authentication.dll" />
1321+
</Component>
1322+
<Component Id="cmpA3BD6FFFE2A4A8906122B0CFCDD774A6" Guid="*">
1323+
<File Id="fil62D73AC54CEAF7CAB45B054BA44F0C55" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.Azure.Common.dll" />
1324+
</Component>
1325+
<Component Id="cmp99392DCBDE8044C2016FF93700B983EB" Guid="*">
1326+
<File Id="fil9A36FC098B4DD67347F5599B2C6E0B49" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.Azure.Management.TrafficManager.dll" />
1327+
</Component>
1328+
<Component Id="cmpF7B36B0AC5A53D62F461D739E7A0CD7F" Guid="*">
1329+
<File Id="filC265B633228818419FDBE0FDD7C0EB31" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" />
1330+
</Component>
1331+
<Component Id="cmp2BC5CD3EEAB03215BAF80C8D91B316F1" Guid="*">
1332+
<File Id="filB061F4ED4F741048AA7F5AF7B3800BC7" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Microsoft.WindowsAzure.Commands.Common.dll" />
1333+
</Component>
1334+
<Component Id="cmp44E9CD59264367064398F4E0170F73B3" Guid="*">
1335+
<File Id="fil92456941883D58DA275F3B6B3A67C9AE" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\Newtonsoft.Json.dll" />
1336+
</Component>
1337+
<Component Id="cmp166C9307AB9128CC171F02474EBC9F38" Guid="*">
1338+
<File Id="fil2EE4D727387984593EACCF967C5A417A" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\TrafficManager\System.Net.Http.Formatting.dll" />
1339+
</Component>
1340+
</Directory>
13091341
<Directory Id="dirC50ADFE5CD118426F389B9B2CD995BF6" Name="Websites">
13101342
<Component Id="cmpCB9C95BF2FE6D784EC47F78CEA8714FE" Guid="*">
13111343
<File Id="fil6C3554ACEEBC9EA8063C3E75065A9154" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Websites\Hyak.Common.dll" />
@@ -3433,6 +3465,16 @@
34333465
<ComponentRef Id="cmp73F733B6769D6142F627750A4BF8A304" />
34343466
<ComponentRef Id="cmp1B114EC22E279C9430B23AB28AEE58EC" />
34353467
<ComponentRef Id="cmp82A0A44868270FCB8A12BD4E0346621F" />
3468+
<ComponentRef Id="cmp77866191B1413E61D7B880F54093D6E9" />
3469+
<ComponentRef Id="cmp7F18AD3C425F41CE8DB8E07CE509DAEA" />
3470+
<ComponentRef Id="cmp0A1CE29CE32BA5CB7B808FB79F598545" />
3471+
<ComponentRef Id="cmpD2BE076C47F8E3FBE7F08523A849CE97" />
3472+
<ComponentRef Id="cmpA3BD6FFFE2A4A8906122B0CFCDD774A6" />
3473+
<ComponentRef Id="cmp99392DCBDE8044C2016FF93700B983EB" />
3474+
<ComponentRef Id="cmpF7B36B0AC5A53D62F461D739E7A0CD7F" />
3475+
<ComponentRef Id="cmp2BC5CD3EEAB03215BAF80C8D91B316F1" />
3476+
<ComponentRef Id="cmp44E9CD59264367064398F4E0170F73B3" />
3477+
<ComponentRef Id="cmp166C9307AB9128CC171F02474EBC9F38" />
34363478
<ComponentRef Id="cmpCB9C95BF2FE6D784EC47F78CEA8714FE" />
34373479
<ComponentRef Id="cmpAA3B522375D7F8190EF55B87EB1EB8D4" />
34383480
<ComponentRef Id="cmp1A3E551E9A3F632A9FF29E4347C0E07F" />

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/Commands.TrafficManager2.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@
107107
<None Include="SessionRecords\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.ProfileTests\TestCreateDeleteUsingProfile.json">
108108
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
109109
</None>
110+
<None Include="SessionRecords\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.ProfileTests\TestCrudWithEndpoint.json">
111+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
112+
</None>
110113
<None Include="SessionRecords\Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.ProfileTests\TestProfileCrud.json">
111114
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
112115
</None>

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/Common.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Creates a resource group to use in tests
7575
#>
7676
function TestSetup-AddEndpoint($endpointName, $profile)
7777
{
78-
$profile = Add-AzureTrafficManagerEndpointConfig -EndpointName $endpointName -TrafficManagerProfile $profile -Type "ExternalEndpoint" -Target "www.contoso.com" -EndpointStatus "Enabled" -EndpointLocation "North Europe"
78+
$profile = Add-AzureTrafficManagerEndpointConfig -EndpointName $endpointName -TrafficManagerProfile $profile -Type "ExternalEndpoints" -Target "www.contoso.com" -EndpointStatus "Enabled" -EndpointLocation "North Europe"
7979

8080
return $profile
8181
}

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/ProfileTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ public void TestCreateDeleteUsingProfile()
4040
WatmV2TestsBase.NewInstance.RunPowerShellTest("Test-CreateDeleteUsingProfile");
4141
}
4242

43+
[Fact]
44+
[Trait(Category.AcceptanceType, Category.CheckIn)]
45+
public void TestCrudWithEndpoint()
46+
{
47+
WatmV2TestsBase.NewInstance.RunPowerShellTest("Test-CrudWithEndpoint");
48+
}
49+
4350
[Fact]
4451
[Trait(Category.AcceptanceType, Category.CheckIn)]
4552
public void TestProfileNewAlreadyExists()

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/ScenarioTests/ProfileTests.ps1

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Full Profile CRUD cycle
1919
function Test-ProfileCrud
2020
{
2121
$profileName = getAssetName
22-
$resourceGroup = TestSetup-CreateResourceGroup
22+
$resourceGroup = TestSetup-CreateResourceGroup
2323
$relativeName = getAssetName
2424
$createdProfile = New-AzureTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $relativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
2525

@@ -91,6 +91,24 @@ function Test-CreateDeleteUsingProfile
9191
Assert-Throws { Get-AzureTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroup.ResourceGroupName } "ResourceNotFound: Resource not found."
9292
}
9393

94+
<#
95+
.SYNOPSIS
96+
Full cycle to create an Endpoint in a Profile
97+
#>
98+
function Test-CrudWithEndpoint
99+
{
100+
$profileName = getAssetName
101+
$resourceGroup = TestSetup-CreateResourceGroup
102+
$relativeName = getAssetName
103+
$createdProfile = New-AzureTrafficManagerProfile -Name $profileName -ResourceGroupName $resourceGroup.ResourceGroupName -RelativeDnsName $relativeName -Ttl 50 -TrafficRoutingMethod "Performance" -MonitorProtocol "HTTP" -MonitorPort 80 -MonitorPath "/testpath.asp"
104+
105+
$profileWithEndpoint = Add-AzureTrafficManagerEndpointConfig -EndpointName "MyExternalEndpoint" -TrafficManagerProfile $createdProfile -Type "ExternalEndpoints" -Target "www.contoso.com" -EndpointStatus "Enabled" -EndpointLocation "North Europe"
106+
107+
$updatedProfile = Set-AzureTrafficManagerProfile -TrafficManagerProfile $profileWithEndpoint
108+
109+
Assert-AreEqual 1 $updatedProfile.Endpoints.Count
110+
}
111+
94112
<#
95113
.SYNOPSIS
96114
Create a Profile that already exists

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/SessionRecords/Microsoft.Azure.Commands.TrafficManager.Test.ScenarioTests.ProfileTests/TestCrudWithEndpoint.json

Lines changed: 434 additions & 0 deletions
Large diffs are not rendered by default.

src/ResourceManager/TrafficManager/Commands.TrafficManager2.Test/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<package id="Microsoft.Azure.Common.Authentication" version="1.0.17-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="0.17.0-preview" targetFramework="net45" />
8+
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
89
<package id="Microsoft.Azure.Management.Resources" version="2.14.1-preview" targetFramework="net45" />
910
<package id="Microsoft.Azure.Test.Framework" version="1.0.5513.27084-prerelease" targetFramework="net45" />
1011
<package id="Microsoft.Azure.Test.HttpRecorder" version="1.0.5513.27084-prerelease" targetFramework="net45" />

src/ResourceManager/TrafficManager/Commands.TrafficManager2/Models/Endpoint.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Microsoft.Azure.Commands.TrafficManager.Models
1616
{
17+
using System;
1718
using Microsoft.Azure.Commands.TrafficManager.Utilities;
1819

1920
public class Endpoint
@@ -28,7 +29,7 @@ public string Type
2829

2930
set
3031
{
31-
if (!value.StartsWith(Constants.ProfileType))
32+
if (!value.StartsWith(Constants.ProfileType, StringComparison.OrdinalIgnoreCase))
3233
{
3334
this.type = string.Format("{0}/{1}", Constants.ProfileType, value);
3435
}

src/ResourceManager/TrafficManager/Commands.TrafficManager2/Models/TrafficManagerProfile.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ public class TrafficManagerProfile
4040

4141
public Profile ToSDKProfile()
4242
{
43-
return new Profile
43+
var profile = new Profile
4444
{
4545
Name = this.Name,
46+
Type = Constants.ProfileType,
4647
Location = TrafficManagerClient.ProfileResourceLocation,
4748
Properties = new ProfileProperties
4849
{
@@ -60,6 +61,30 @@ public Profile ToSDKProfile()
6061
}
6162
}
6263
};
64+
65+
if (this.Endpoints.Count > 0)
66+
{
67+
profile.Properties.Endpoints = new List<Management.TrafficManager.Models.Endpoint>();
68+
69+
foreach (Endpoint endpoint in this.Endpoints)
70+
{
71+
profile.Properties.Endpoints.Add(new Management.TrafficManager.Models.Endpoint
72+
{
73+
Name = endpoint.Name,
74+
Type = endpoint.Type,
75+
Properties = new EndpointProperties
76+
{
77+
Target = endpoint.Target,
78+
EndpointStatus = endpoint.EndpointStatus,
79+
Weight = endpoint.Weight,
80+
Priority = endpoint.Priority,
81+
EndpointLocation = endpoint.Location
82+
}
83+
});
84+
}
85+
}
86+
87+
return profile;
6388
}
6489
}
6590
}

src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/Constants.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ namespace Microsoft.Azure.Commands.TrafficManager.Utilities
1616
{
1717
public class Constants
1818
{
19-
public const string AzureEndpoint = "AzureEndpoint";
20-
public const string ExternalEndpoint = "ExternalEndpoint";
21-
public const string NestedEndpoint = "NestedEndpoint";
19+
public const string AzureEndpoint = "AzureEndpoints";
20+
public const string ExternalEndpoint = "ExternalEndpoints";
21+
public const string NestedEndpoint = "NestedEndpoints";
2222

2323
public const string StatusEnabled = "Enabled";
2424
public const string StatusDisabled = "Disabled";
@@ -30,6 +30,6 @@ public class Constants
3030
public const string HTTP = "HTTP";
3131
public const string HTTPS = "HTTPS";
3232

33-
public const string ProfileType = "Microsoft.Network/TrafficManagerProfiles";
33+
public const string ProfileType = "Microsoft.Network/trafficManagerProfiles";
3434
}
3535
}

src/ResourceManager/TrafficManager/Commands.TrafficManager2/Utilities/TrafficManagerClient.cs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Microsoft.Azure.Commands.TrafficManager.Utilities
1616
{
17+
using System.Collections.Generic;
1718
using System.Net;
1819
using Microsoft.Azure.Commands.TrafficManager.Models;
1920
using Microsoft.Azure.Common.Authentication;
@@ -79,13 +80,16 @@ public TrafficManagerProfile GetTrafficManagerProfile(string resourceGroupName,
7980

8081
public TrafficManagerProfile SetTrafficManagerProfile(TrafficManagerProfile profile)
8182
{
83+
var parameteres = new ProfileCreateOrUpdateParameters
84+
{
85+
Profile = profile.ToSDKProfile()
86+
};
87+
8288
ProfileCreateOrUpdateResponse response = this.TrafficManagerManagementClient.Profiles.CreateOrUpdate(
8389
profile.ResourceGroupName,
8490
profile.Name,
85-
new ProfileCreateOrUpdateParameters
86-
{
87-
Profile = profile.ToSDKProfile()
88-
});
91+
parameteres
92+
);
8993

9094
return TrafficManagerClient.GetPowershellTrafficManagerProfile(profile.ResourceGroupName, profile.Name, response.Profile.Properties);
9195
}
@@ -99,7 +103,7 @@ public bool DeleteTrafficManagerProfile(TrafficManagerProfile profile)
99103

100104
private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string resourceGroupName, string profileName, ProfileProperties mamlProfileProperties)
101105
{
102-
return new TrafficManagerProfile
106+
var profile = new TrafficManagerProfile
103107
{
104108
Name = profileName,
105109
ResourceGroupName = resourceGroupName,
@@ -110,6 +114,27 @@ private static TrafficManagerProfile GetPowershellTrafficManagerProfile(string r
110114
MonitorPort = mamlProfileProperties.MonitorConfig.Port,
111115
MonitorPath = mamlProfileProperties.MonitorConfig.Path
112116
};
117+
118+
if (mamlProfileProperties.Endpoints != null)
119+
{
120+
profile.Endpoints = new List<Models.Endpoint>();
121+
122+
foreach (Endpoint endpoint in mamlProfileProperties.Endpoints)
123+
{
124+
profile.Endpoints.Add(new Models.Endpoint
125+
{
126+
Name = endpoint.Name,
127+
Type = endpoint.Type,
128+
Target = endpoint.Properties.Target,
129+
EndpointStatus = endpoint.Properties.EndpointStatus,
130+
Location = endpoint.Properties.EndpointLocation,
131+
Priority = endpoint.Properties.Priority,
132+
Weight = endpoint.Properties.Weight
133+
});
134+
}
135+
}
136+
137+
return profile;
113138
}
114139
}
115140
}

0 commit comments

Comments
 (0)