Skip to content

Commit 471f374

Browse files
author
Maddie Clayton
authored
Merge pull request #5585 from markcowl/websimple
Website convenience cmdlets
2 parents 4491ebc + a01f07a commit 471f374

File tree

48 files changed

+11443
-10745
lines changed

Some content is hidden

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

48 files changed

+11443
-10745
lines changed

src/ResourceManager/Common/Commands.ResourceManager.Common/Commands.ResourceManager.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
<Compile Include="Utilities\Models\DeploymentVariable.cs" />
202202
<Compile Include="Utilities\Models\FilterResourcesOptions.cs" />
203203
<Compile Include="Utilities\Models\GenericResource.cs" />
204+
<Compile Include="Utilities\Models\Location.cs" />
204205
<Compile Include="Utilities\Models\ResourceGroupDeployment.cs" />
205206
<Compile Include="Utilities\Models\ResourceIdentifier.cs" />
206207
<Compile Include="Utilities\ResourceManagementClientExtensions.cs" />
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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+
using System;
15+
using System.Collections.Generic;
16+
using System.Linq;
17+
using System.Text;
18+
using System.Threading.Tasks;
19+
20+
namespace Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Models
21+
{
22+
public class LocationConstraint
23+
{
24+
ICollection<string> _locations = new List<string>();
25+
26+
public LocationConstraint(params string[] locations)
27+
{
28+
foreach (var inputLocation in locations)
29+
{
30+
if (string.IsNullOrEmpty(inputLocation))
31+
{
32+
throw new ArgumentNullException(nameof(inputLocation));
33+
}
34+
35+
_locations.Add(Canonicalize(inputLocation));
36+
}
37+
}
38+
static string Canonicalize(string input)
39+
{
40+
var builder = new StringBuilder();
41+
var skipChars = new[] { ' ', '-' };
42+
foreach (char c in input.ToLowerInvariant())
43+
{
44+
if (!skipChars.Contains(c))
45+
{
46+
builder.Append(c);
47+
}
48+
}
49+
50+
return builder.ToString();
51+
}
52+
53+
public bool Match(string other)
54+
{
55+
if (!string.IsNullOrWhiteSpace(other))
56+
{
57+
58+
var canonical = Canonicalize(other);
59+
foreach (var location in _locations)
60+
{
61+
if (string.Equals(location, canonical, StringComparison.Ordinal))
62+
{
63+
return true;
64+
}
65+
}
66+
}
67+
68+
return _locations.Count == 0;
69+
}
70+
}
71+
}

src/ResourceManager/Websites/AzureRM.Websites.Netcore.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ PowerShellVersion = '5.1'
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0.10.0'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll'
57+
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll', '.\Microsoft.Azure.Commands.Common.Strategies.3.dll'
5858

5959
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6060
# ScriptsToProcess = @()

src/ResourceManager/Websites/AzureRM.Websites.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ CLRVersion = '4.0'
5454
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '4.3.1'; })
5555

5656
# Assemblies that must be loaded prior to importing this module
57-
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll'
57+
RequiredAssemblies = '.\Microsoft.Azure.Management.Websites.dll', '.\Microsoft.Azure.Commands.Common.Strategies.3.dll'
5858

5959
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
6060
# ScriptsToProcess = @()

src/ResourceManager/Websites/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
## Current Release
2121
* Fixed issue with importing aliases
2222

23+
* New-AzureRMWebApp - added parameter set for simplified WebApp creation, with local git repository support.
24+
2325
## Version 4.1.0
2426
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
2527
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription

src/ResourceManager/Websites/Commands.Websites.Test/Commands.Websites.Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,5 @@
334334
</ItemGroup>
335335
<ItemGroup />
336336
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
337+
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
337338
</Project>

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppBackupRestoreTests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ function Test-CreateNewWebAppBackupPiping
7070
Assert-AreEqual $backupName $backup.BackupName
7171
Assert-NotNull $backup.StorageAccountUrl
7272

73+
$count = 0
74+
while (($backup.BackupStatus -like "Created" -or $backup.BackupStatus -like "InProgress") -and $count -le 20)
75+
{
76+
Wait-Seconds 30
77+
$backup = $backup | Get-AzureRmWebAppBackup
78+
$count++
79+
}
80+
7381
# Test that it's possible to modify the return value of the cmdlet to make a new backup
7482
$backup.BackupName = $backupName2
7583
$backup2 = $backup | New-AzureRmWebAppBackup

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppSlotTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void TestCreateNewWebAppSlot()
3535
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppSlot");
3636
}
3737

38-
[Fact]
38+
[Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")]
3939
[Trait(Category.AcceptanceType, Category.CheckIn)]
4040
public void TestCreateNewWebAppSlotOnAse()
4141
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppSlotTests.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ function Test-CloneWebAppSlot
357357
Assert-AreEqual $serverFarm2.Id $webapp2.ServerFarmId
358358

359359
# Clone web app to slot
360-
$slot2 = New-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $destAppName -Slot $slotname -AppServicePlan $planName -SourceWebApp $slot1
360+
$slot2 = New-AzureRmWebAppSlot -ResourceGroupName $rgname -Name $destAppName -Slot $slotname -AppServicePlan $destPlanName -SourceWebApp $slot1
361361
$appWithSlotName2 = "$destAppName/$slotname"
362362

363363
# Assert
@@ -445,14 +445,14 @@ function Test-CreateNewWebAppSlotOnAse
445445
$slotname = "staging"
446446
$location = "West US"
447447
$planName = "travel_production_plan"
448-
$aseName = "asedemo"
448+
$aseName = "asedemops"
449449

450450
$apiversion = "2015-08-01"
451451
$resourceType = "Microsoft.Web/sites"
452452
try
453453
{
454454
#Setup
455-
$serverFarm = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $planName
455+
$serverFarm = Get-AzureRmAppServicePlan | select -First 1
456456

457457
# Create new web app
458458
$actual = New-AzureRmWebApp -ResourceGroupName $rgname -Name $appname -Location $location -AppServicePlan $planName -AseName $aseName

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void TestCreateNewWebApp()
3737
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebApp");
3838
}
3939

40-
[Fact]
40+
[Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")]
4141
[Trait(Category.AcceptanceType, Category.CheckIn)]
4242
public void TestCreateNewAppOnAse()
4343
{
@@ -79,7 +79,7 @@ public void TestCloneNewWebAppAndDeploymentSlots()
7979
WebsitesController.NewInstance.RunPsTest(xunitLogger, "Test-CloneNewWebAppAndDeploymentSlots");
8080
}
8181

82-
[Fact]
82+
[Fact(Skip = "TODO #5594: This test requires a pre-set Traffic Manger Profile with specific settings.")]
8383
[Trait(Category.AcceptanceType, Category.CheckIn)]
8484
public void TestCloneNewWebAppWithNewTrafficManager()
8585
{

src/ResourceManager/Websites/Commands.Websites.Test/ScenarioTests/WebAppTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ function Test-CreateNewWebAppOnAse
531531
$wname = Get-WebsiteName
532532
$location = "West US"
533533
$whpName = "travel_production_plan"
534-
$aseName = "asedemo"
534+
$aseName = "asedemops"
535535
$apiversion = "2015-08-01"
536536
$resourceType = "Microsoft.Web/sites"
537537
try

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestCreateNewWebAppBackup.json

Lines changed: 363 additions & 474 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestCreateNewWebAppBackupPiping.json

Lines changed: 466 additions & 445 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestEditAndGetWebAppBackupConfiguration.json

Lines changed: 352 additions & 463 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestEditAndGetWebAppBackupConfigurationPiping.json

Lines changed: 424 additions & 475 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestGetWebAppBackup.json

Lines changed: 406 additions & 454 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppBackupRestoreTests/TestGetWebAppBackupList.json

Lines changed: 369 additions & 477 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCloneWebAppSlot.json

Lines changed: 909 additions & 753 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCloneWebAppToSlot.json

Lines changed: 546 additions & 933 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestCreateNewWebAppSlot.json

Lines changed: 439 additions & 529 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestGetWebAppSlot.json

Lines changed: 655 additions & 703 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestSetWebAppSlot.json

Lines changed: 826 additions & 613 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestStartStopRestartWebAppSlot.json

Lines changed: 804 additions & 816 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppSlotTests/TestWebAppSlotPublishingProfile.json

Lines changed: 437 additions & 578 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestCloneNewWebApp.json

Lines changed: 535 additions & 655 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestCreateNewWebApp.json

Lines changed: 297 additions & 414 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestRemoveWebApp.json

Lines changed: 266 additions & 158 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestSetWebApp.json

Lines changed: 757 additions & 568 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestStartStopRestartWebApp.json

Lines changed: 724 additions & 763 deletions
Large diffs are not rendered by default.

src/ResourceManager/Websites/Commands.Websites.Test/SessionRecords/Microsoft.Azure.Commands.Websites.Test.ScenarioTests.WebAppTests/TestWebAppPublishingProfile.json

Lines changed: 414 additions & 391 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)