Skip to content

Website convenience cmdlets #5585

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 24 commits into from
Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f944a02
Initial strategy implementation
markcowl Dec 7, 2017
7050816
Updates to website strategy implementation
markcowl Dec 18, 2017
590f5b2
Merge branch 'preview' of github.com:/azure/azure-powershell into web…
markcowl Jan 8, 2018
d3c8159
Flesh out websites strategies and adapters to cmdlet code
markcowl Jan 10, 2018
3393ae7
Merging with upstream
markcowl Jan 20, 2018
786d00b
websimple
markcowl Jan 20, 2018
8a0ad4c
Completing website addition
markcowl Jan 22, 2018
b1bcafc
Merging with latest Website fixes
markcowl Feb 5, 2018
e9d5a79
Saving changes
markcowl Feb 9, 2018
65e04ce
Merge branch 'preview' of github.com:/azure/azure-powershell into web…
markcowl Feb 16, 2018
bd5e0eb
End to end cmdlet for web sites
markcowl Feb 20, 2018
4ae2a57
rerecording some tests
markcowl Feb 20, 2018
164b812
Text fixes and rerecording tests
markcowl Feb 21, 2018
d3fad1a
Skip tests with undocument pre-setup steps
markcowl Feb 21, 2018
467d9b2
Update simple parameter set to exclude cloning parameters
markcowl Mar 2, 2018
6e9e1fc
Adjust algorithm for getting default serverFarm
markcowl Mar 3, 2018
fb149bb
Fix progress reporting
markcowl Mar 3, 2018
4bb438d
Merge branch 'preview' of github.com:/azure/azure-powershell into web…
markcowl Mar 3, 2018
3661e14
Updating for new strategies library, review comments, fix issues
markcowl Mar 5, 2018
261d9d8
Update changelog for new changes
markcowl Mar 5, 2018
250bfcd
Add breaking change suppressions for non-breaking changes
markcowl Mar 5, 2018
97fc505
Fix for website NetCore build
markcowl Mar 5, 2018
e4ed748
Add implementation for NetCore
markcowl Mar 5, 2018
a01f07a
Update changelog per review comments
markcowl Mar 5, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
<Compile Include="Utilities\Models\DeploymentVariable.cs" />
<Compile Include="Utilities\Models\FilterResourcesOptions.cs" />
<Compile Include="Utilities\Models\GenericResource.cs" />
<Compile Include="Utilities\Models\Location.cs" />
<Compile Include="Utilities\Models\ResourceGroupDeployment.cs" />
<Compile Include="Utilities\Models\ResourceIdentifier.cs" />
<Compile Include="Utilities\ResourceManagementClientExtensions.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// ----------------------------------------------------------------------------------
//
// 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.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.Azure.Commands.ResourceManager.Common.Utilities.Models
{
public class LocationConstraint
{
ICollection<string> _locations = new List<string>();

public LocationConstraint(params string[] locations)
{
foreach (var inputLocation in locations)
{
if (string.IsNullOrEmpty(inputLocation))
{
throw new ArgumentNullException(nameof(inputLocation));
}

_locations.Add(Canonicalize(inputLocation));
}
}
static string Canonicalize(string input)
{
var builder = new StringBuilder();
var skipChars = new[] { ' ', '-' };
foreach (char c in input.ToLowerInvariant())
{
if (!skipChars.Contains(c))
{
builder.Append(c);
}
}

return builder.ToString();
}

public bool Match(string other)
{
if (!string.IsNullOrWhiteSpace(other))
{

var canonical = Canonicalize(other);
foreach (var location in _locations)
{
if (string.Equals(location, canonical, StringComparison.Ordinal))
{
return true;
}
}
}

return _locations.Count == 0;
}
}
}
2 changes: 1 addition & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.Netcore.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PowerShellVersion = '5.1'
RequiredModules = @(@{ModuleName = 'AzureRM.Profile.Netcore'; ModuleVersion = '0.10.0'; })

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

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Websites/AzureRM.Websites.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CLRVersion = '4.0'
RequiredModules = @(@{ModuleName = 'AzureRM.Profile'; ModuleVersion = '4.3.1'; })

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

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()
Expand Down
2 changes: 2 additions & 0 deletions src/ResourceManager/Websites/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
-->
## Current Release

* New-AzureRMWebApp - added parameter set for simplified WebApp creation, with local git repository support.

## Version 4.1.0
* Added Location Completer to -Location parameters allowing tab completion through valid Locations
* Added ResourceGroup Completer to -ResourceGroup parameters allowing tab completion through resource groups in current subscription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,5 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<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')" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ function Test-CreateNewWebAppBackupPiping
Assert-AreEqual $backupName $backup.BackupName
Assert-NotNull $backup.StorageAccountUrl

$count = 0
while (($backup.BackupStatus -like "Created" -or $backup.BackupStatus -like "InProgress") -and $count -le 20)
{
Wait-Seconds 30
$backup = $backup | Get-AzureRmWebAppBackup
$count++
}

# Test that it's possible to modify the return value of the cmdlet to make a new backup
$backup.BackupName = $backupName2
$backup2 = $backup | New-AzureRmWebAppBackup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void TestCreateNewWebAppSlot()
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebAppSlot");
}

[Fact]
[Fact(Skip = "TODO #5594: This test requires a pre-set AppService Environment with specific settings.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateNewWebAppSlotOnAse()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ function Test-CloneWebAppSlot
Assert-AreEqual $serverFarm2.Id $webapp2.ServerFarmId

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

# Assert
Expand Down Expand Up @@ -445,14 +445,14 @@ function Test-CreateNewWebAppSlotOnAse
$slotname = "staging"
$location = "West US"
$planName = "travel_production_plan"
$aseName = "asedemo"
$aseName = "asedemops"

$apiversion = "2015-08-01"
$resourceType = "Microsoft.Web/sites"
try
{
#Setup
$serverFarm = Get-AzureRmAppServicePlan -ResourceGroupName $rgname -Name $planName
$serverFarm = Get-AzureRmAppServicePlan | select -First 1

# Create new web app
$actual = New-AzureRmWebApp -ResourceGroupName $rgname -Name $appname -Location $location -AppServicePlan $planName -AseName $aseName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void TestCreateNewWebApp()
WebsitesController.NewInstance.RunPsTest("Test-CreateNewWebApp");
}

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

[Fact]
[Fact(Skip = "TODO #5594: This test requires a pre-set Traffic Manger Profile with specific settings.")]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCloneNewWebAppWithNewTrafficManager()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ function Test-CreateNewWebAppOnAse
$wname = Get-WebsiteName
$location = "West US"
$whpName = "travel_production_plan"
$aseName = "asedemo"
$aseName = "asedemops"
$apiversion = "2015-08-01"
$resourceType = "Microsoft.Web/sites"
try
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading