diff --git a/src/AzurePowershell.sln b/src/AzurePowershell.sln index 8be43bf6ad2e..b7d71b9e15cd 100644 --- a/src/AzurePowershell.sln +++ b/src/AzurePowershell.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}" ProjectSection(SolutionItems) = preProject @@ -161,7 +161,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics.Te EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights", "ResourceManager\Insights\Commands.Insights\Commands.Insights.csproj", "{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights.Test", "ResourceManager\Insights\Commands.Insights.Test\Commands.Insights.Test.csproj", "{469F20E0-9D40-41AD-94C3-B47AD15A4C00}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Websites", "ResourceManager\Websites\Commands.Websites\Commands.Websites.csproj", "{80A92297-7C92-456B-8EE7-9FB6CE30149D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -393,10 +393,10 @@ Global {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Debug|Any CPU.Build.0 = Debug|Any CPU {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.ActiveCfg = Release|Any CPU {DEA446A1-84E2-46CC-B780-EB4AFDE2460E}.Release|Any CPU.Build.0 = Release|Any CPU - {469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Debug|Any CPU.Build.0 = Debug|Any CPU - {469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Release|Any CPU.ActiveCfg = Release|Any CPU - {469F20E0-9D40-41AD-94C3-B47AD15A4C00}.Release|Any CPU.Build.0 = Release|Any CPU + {80A92297-7C92-456B-8EE7-9FB6CE30149D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80A92297-7C92-456B-8EE7-9FB6CE30149D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80A92297-7C92-456B-8EE7-9FB6CE30149D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80A92297-7C92-456B-8EE7-9FB6CE30149D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -429,6 +429,5 @@ Global {A415F75B-EB6A-49A6-934E-5BA71B83D6EB} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {0FA676D5-1349-4086-B33F-65EC2CB7DA41} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} {7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} - {469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817} EndGlobalSection EndGlobal diff --git a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 index e8ac25f5fb5f..67b1ebe0f743 100644 --- a/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 +++ b/src/ResourceManager/Resources/Commands.Resources/AzureResourceManager.psd1 @@ -66,6 +66,7 @@ FormatsToProcess = @( '.\Batch\Microsoft.Azure.Commands.Batch.format.ps1xml', '.\KeyVault\Microsoft.Azure.Commands.KeyVault.format.ps1xml', '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml' + '.\Websites\Microsoft.Azure.Commands.Websites.format.ps1xml' ) # Modules to import as nested modules of the module specified in ModuleToProcess @@ -80,6 +81,7 @@ NestedModules = @( '.\KeyVault\Microsoft.Azure.Commands.KeyVault.dll', '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.dll', '.\Insights\Microsoft.Azure.Commands.Insights.dll' + '.\Websites\Microsoft.Azure.Commands.Websites.dll' ) # Functions to export from this module diff --git a/src/ResourceManager/Websites/Commands.Websites/AzureResourceManager.psd1 b/src/ResourceManager/Websites/Commands.Websites/AzureResourceManager.psd1 new file mode 100644 index 000000000000..37c79ae2a38a --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/AzureResourceManager.psd1 @@ -0,0 +1,107 @@ +# +# Module manifest for module 'Microsoft.Azure.Commands.Resources' +# +# Generated by: Microsoft Corporation +# +# Generated on: 4/01/2014 +# + +@{ + +# Version number of this module. +ModuleVersion = '0.8.13' + +# ID used to uniquely identify this module +GUID = '81d522a4-6e5d-4105-8f58-376204c47458' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '� Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '3.0' + +# Name of the Windows PowerShell host required by this module +PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +PowerShellHostVersion = '' + +# Minimum version of the .NET Framework required by this module +DotNetFrameworkVersion = '4.0' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion='4.0' + +# Processor architecture (None, X86, Amd64, IA64) required by this module +ProcessorArchitecture = 'None' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module +ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @( + '.\Resources\Microsoft.Azure.Commands.Resources.format.ps1xml', + '.\Tags\Microsoft.Azure.Commands.Tags.format.ps1xml', + '.\Resources\Microsoft.WindowsAzure.Commands.Profile.format.ps1xml', + '.\DataFactories\Microsoft.Azure.Commands.DataFactories.format.ps1xml', + '.\RedisCache\Microsoft.Azure.Commands.RedisCache.format.ps1xml', + '.\Batch\Microsoft.Azure.Commands.Batch.format.ps1xml', + '.\KeyVault\Microsoft.Azure.Commands.KeyVault.format.ps1xml' + '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.format.ps1xml' + '.\Websites\Microsoft.Azure.Commands.Websites.format.ps1xml' + ) + +# Modules to import as nested modules of the module specified in ModuleToProcess +NestedModules = @( + '.\Resources\Microsoft.Azure.Commands.Resources.dll', + '.\Resources\Microsoft.WindowsAzure.Commands.Profile.dll', + '.\Tags\Microsoft.Azure.Commands.Tags.dll', + '.\Sql\Microsoft.Azure.Commands.Sql.dll', + '.\DataFactories\Microsoft.Azure.Commands.DataFactories.dll', + '.\RedisCache\Microsoft.Azure.Commands.RedisCache.dll', + '.\Batch\Microsoft.Azure.Commands.Batch.dll', + '.\KeyVault\Microsoft.Azure.Commands.KeyVault.dll' + '.\StreamAnalytics\Microsoft.Azure.Commands.StreamAnalytics.dll' + '.\Websites\Microsoft.Azure.Commands.Websites.dll' + ) + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = @() + +# List of all modules packaged with this module +ModuleList = @() + +# List of all files packaged with this module +FileList = @() + +# Private data to pass to the module specified in ModuleToProcess +PrivateData = '' + +} diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/NewAzureWebsites.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/NewAzureWebsites.cs new file mode 100644 index 000000000000..b7af73e6f740 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/NewAzureWebsites.cs @@ -0,0 +1,88 @@ +// ---------------------------------------------------------------------------------- +// +// 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; + +using System.Management.Automation; +using Microsoft.Azure.Management.WebSites.Models; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Utilities.CloudService; +using Microsoft.Azure.Commands.Websites; +using Microsoft.Azure.Management.WebSites; +using System.Net.Http; +using System.Threading; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System.Net; +using Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Websites.Utilities; + + +namespace Microsoft.Azure.Commands.Websites.Cmdlets +{ + /// + /// this commandlet will let you create a new backuppolicy with schedules + /// + [Cmdlet(VerbsCommon.New, "AzureWebsite")] + public class NewAzureWebsiteCmdlet : AzurePSCmdlet + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the resource group.")] + [ValidateNotNullOrEmptyAttribute] + public string ResourceGroupName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The name of the website.")] + [ValidateNotNullOrEmptyAttribute] + public string WebsiteName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] + [ValidateNotNullOrEmptyAttribute] + public string SlotName { get; set; } + + [Parameter(Position = 3, Mandatory = true, HelpMessage = "The Location of the Website eg: West US.")] + public string Location { get; set; } + + [Parameter(Position = 4, Mandatory = true, HelpMessage = "The name of the web hosting plan eg: Default1.")] + public string WebHostingPlan { get; set; } + + private WebsitesClient _websitesClient; + private WebsitesClient WebsitesClient + { + get + { + if (_websitesClient == null) + { + _websitesClient = new WebsitesClient(CurrentContext); + } + return _websitesClient; + } + } + + + + public override void ExecuteCmdlet() + { + WriteObject(WebsitesClient.CreateWebsite(ResourceGroupName, WebsiteName, SlotName, Location, WebHostingPlan)); + + } + + } +} + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RemoveAzureWebsite.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RemoveAzureWebsite.cs new file mode 100644 index 000000000000..dc093d28b3c3 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RemoveAzureWebsite.cs @@ -0,0 +1,114 @@ + +// ---------------------------------------------------------------------------------- +// +// 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; + +using System.Management.Automation; +using Microsoft.Azure.Management.WebSites.Models; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Utilities.CloudService; +using Microsoft.Azure.Commands.Websites; +using Microsoft.Azure.Management.WebSites; +using System.Net.Http; +using System.Threading; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System.Net; +using Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Websites.Utilities; + + +namespace Microsoft.Azure.Commands.Websites.Cmdlets +{ + /// + /// this commandlet will let you create a new backuppolicy with schedules + /// + [Cmdlet(VerbsCommon.Remove, "AzureWebsite")] + public class RemoveAzureWebsiteCmdlet : AzurePSCmdlet + { + + private bool deleteSlotsBydefault = false; + private bool deleteEmptyServerFarmBydefault = false; + private bool deleteMetricsBydefault = false; + + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the resource group.")] + [ValidateNotNullOrEmptyAttribute] + public string ResourceGroupName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The name of the website.")] + [ValidateNotNullOrEmptyAttribute] + public string WebsiteName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] + [ValidateNotNullOrEmptyAttribute] + public string SlotName { get; set; } + + [Parameter(Position = 3, Mandatory = true, HelpMessage = "Delete all website slots?")] + [ValidateNotNullOrEmptyAttribute] + public bool DeleteAllSlots + { + get { return this.deleteSlotsBydefault; } + set { this.deleteSlotsBydefault = value; } + } + + [Parameter(Position = 4, Mandatory = true, HelpMessage = "Delete empty website server farm?")] + [ValidateNotNullOrEmptyAttribute] + public bool DeleteEmptyServerFarm + { + get { return this.deleteEmptyServerFarmBydefault; } + set { this.deleteEmptyServerFarmBydefault = value; } + } + + [Parameter(Position = 5, Mandatory = true, HelpMessage = "Delete website metrics?")] + [ValidateNotNullOrEmptyAttribute] + public bool DeleteMetrics + { + get { return this.deleteMetricsBydefault; } + set { this.deleteMetricsBydefault = value; } + } + + + + + private WebsitesClient _websitesClient; + private WebsitesClient WebsitesClient + { + get + { + if (_websitesClient == null) + { + _websitesClient = new WebsitesClient(CurrentContext); + } + return _websitesClient; + } + } + + + + public override void ExecuteCmdlet() + { + WriteObject(WebsitesClient.RemoveWebsite(ResourceGroupName, WebsiteName, SlotName, deleteEmptyServerFarmBydefault, deleteMetricsBydefault, deleteSlotsBydefault)); + } + + } +} + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RestartAzureWebsite.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RestartAzureWebsite.cs new file mode 100644 index 000000000000..b731fb89032b --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/RestartAzureWebsite.cs @@ -0,0 +1,84 @@ + +// ---------------------------------------------------------------------------------- +// +// 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; + +using System.Management.Automation; +using Microsoft.Azure.Management.WebSites.Models; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Utilities.CloudService; +using Microsoft.Azure.Commands.Websites; +using Microsoft.Azure.Management.WebSites; +using System.Net.Http; +using System.Threading; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System.Net; +using Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Websites.Utilities; + + +namespace Microsoft.Azure.Commands.Websites.Cmdlets +{ + /// + /// this commandlet will let you create a new backuppolicy with schedules + /// + [Cmdlet(VerbsLifecycle.Restart, "AzureWebsite")] + public class RestartAzureWebsiteCmdlet : AzurePSCmdlet + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the resource group.")] + [ValidateNotNullOrEmptyAttribute] + public string ResourceGroupName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The name of the website.")] + [ValidateNotNullOrEmptyAttribute] + public string WebsiteName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] + [ValidateNotNullOrEmptyAttribute] + public string SlotName { get; set; } + + + private WebsitesClient _websitesClient; + private WebsitesClient WebsitesClient + { + get + { + if (_websitesClient == null) + { + _websitesClient = new WebsitesClient(CurrentContext); + } + return _websitesClient; + } + } + + + + public override void ExecuteCmdlet() + { + WriteObject(WebsitesClient.RestartWebsite(ResourceGroupName, WebsiteName, SlotName)); + } + + } +} + + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StartAzureWebsite.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StartAzureWebsite.cs new file mode 100644 index 000000000000..aef812a0082a --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StartAzureWebsite.cs @@ -0,0 +1,83 @@ + +// ---------------------------------------------------------------------------------- +// +// 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; + +using System.Management.Automation; +using Microsoft.Azure.Management.WebSites.Models; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Utilities.CloudService; +using Microsoft.Azure.Commands.Websites; +using Microsoft.Azure.Management.WebSites; +using System.Net.Http; +using System.Threading; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System.Net; +using Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Websites.Utilities; + + +namespace Microsoft.Azure.Commands.Websites.Cmdlets +{ + /// + /// this commandlet will let you create a new backuppolicy with schedules + /// + [Cmdlet(VerbsLifecycle.Start, "AzureWebsite")] + public class StartAzureWebsiteCmdlet : AzurePSCmdlet + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the resource group.")] + [ValidateNotNullOrEmptyAttribute] + public string ResourceGroupName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The name of the website.")] + [ValidateNotNullOrEmptyAttribute] + public string WebsiteName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] + [ValidateNotNullOrEmptyAttribute] + public string SlotName { get; set; } + + private WebsitesClient _websitesClient; + private WebsitesClient WebsitesClient + { + get + { + if (_websitesClient == null) + { + _websitesClient = new WebsitesClient(CurrentContext); + } + return _websitesClient; + } + } + + + + public override void ExecuteCmdlet() + { + WriteObject(WebsitesClient.StartWebsite(ResourceGroupName, WebsiteName, SlotName)); + + } + + } +} + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StopAzureWebsite.cs b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StopAzureWebsite.cs new file mode 100644 index 000000000000..6c647dfb79a7 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Cmdlets/StopAzureWebsite.cs @@ -0,0 +1,83 @@ + +// ---------------------------------------------------------------------------------- +// +// 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; + +using System.Management.Automation; +using Microsoft.Azure.Management.WebSites.Models; +using Microsoft.WindowsAzure; +using Microsoft.WindowsAzure.Commands.Utilities.CloudService; +using Microsoft.Azure.Commands.Websites; +using Microsoft.Azure.Management.WebSites; +using System.Net.Http; +using System.Threading; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using System.Net; +using Microsoft.Azure; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using Microsoft.Azure.Commands.Websites.Utilities; + + +namespace Microsoft.Azure.Commands.Websites.Cmdlets +{ + /// + /// this commandlet will let you create a new backuppolicy with schedules + /// + [Cmdlet(VerbsLifecycle.Stop, "AzureWebsite")] + public class StopAzureWebsiteCmdlet : AzurePSCmdlet + { + [Parameter(Position = 0, Mandatory = true, HelpMessage = "The name of the resource group.")] + [ValidateNotNullOrEmptyAttribute] + public string ResourceGroupName { get; set; } + + [Parameter(Position = 1, Mandatory = true, HelpMessage = "The name of the website.")] + [ValidateNotNullOrEmptyAttribute] + public string WebsiteName { get; set; } + + [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] + [ValidateNotNullOrEmptyAttribute] + public string SlotName { get; set; } + + + private WebsitesClient _websitesClient; + private WebsitesClient WebsitesClient + { + get + { + if (_websitesClient == null) + { + _websitesClient = new WebsitesClient(CurrentContext); + } + return _websitesClient; + } + } + + + + public override void ExecuteCmdlet() + { + WriteObject(WebsitesClient.StopWebsite(ResourceGroupName, WebsiteName, SlotName)); + } + + } +} + + + diff --git a/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj b/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj new file mode 100644 index 000000000000..6d4b8825013b --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Commands.Websites.csproj @@ -0,0 +1,218 @@ + + + + + Debug + AnyCPU + {80A92297-7C92-456B-8EE7-9FB6CE30149D} + Library + Properties + Microsoft.Azure.Commands.Websites + Microsoft.Azure.Commands.Websites + v4.5 + 512 + + ..\..\..\ + true + /assemblyCompareMode:StrongNameIgnoringVersion + + + true + full + false + ..\..\..\Package\Debug\ResourceManager\AzureResourceManager\Websites\ + DEBUG;TRACE + prompt + 4 + true + true + false + + + ..\..\..\Package\Release\ResourceManager\AzureResourceManager\Resources + TRACE;SIGN + true + pdbonly + AnyCPU + bin\Release\Microsoft.Azure.Commands.Resources.dll.CodeAnalysisLog.xml + true + GlobalSuppressions.cs + prompt + MinimumRecommendedRules.ruleset + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\Rule Sets + ;$(ProgramFiles)\Microsoft Visual Studio 12.0\Team Tools\Static Analysis Tools\FxCop\Rules + true + true + MSSharedLibKey.snk + true + false + + + + ..\..\..\packages\Hyak.Common.1.0.1\lib\portable-net403+win+wpa81\Hyak.Common.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.dll + + + False + ..\..\..\packages\Microsoft.Azure.Common.Extensions.0.13.0-preview\lib\net45\Microsoft.Azure.Common.Extensions.dll + + + ..\..\..\packages\Microsoft.Azure.Common.2.0.1\lib\net45\Microsoft.Azure.Common.NetFramework.dll + + + False + ..\..\..\packages\Microsoft.Azure.Gallery.2.6.0-preview\lib\net40\Microsoft.Azure.Gallery.dll + + + False + ..\..\..\packages\Microsoft.Azure.Graph.RBAC.1.6.0-preview\lib\net40\Microsoft.Azure.Graph.RBAC.dll + + + False + ..\..\..\packages\Microsoft.Azure.Management.Authorization.0.16.0-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll + + + ..\..\..\packages\Microsoft.Azure.Management.WebSites.0.16.0-prerelease\lib\net40\Microsoft.Azure.Management.WebSites.dll + + + False + ..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll + + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll + + + False + ..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.11.10918.1222\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + False + ..\..\..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + + + False + ..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.0\lib\net40\Microsoft.WindowsAzure.Management.dll + + + ..\..\..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll + True + + + + + + + False + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Extensions.dll + + + False + ..\..\..\packages\Microsoft.Net.Http.2.2.28\lib\net45\System.Net.Http.Primitives.dll + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + {5ee72c53-1720-4309-b54b-5fb79703195f} + Commands.Common + + + {c60342b1-47d3-4a0e-8081-9b97ce60b7af} + Commands.Profile + + + {4900ec4e-8deb-4412-9108-0bc52f81d457} + Commands.Utilities + + + {11524d98-6c40-4091-a8e1-86463fee607c} + Commands.StorSimple + + + {d470e50a-9607-48d6-a924-4f9f86502704} + Commands.Batch + + + {9ffc40cc-a341-4d0c-a25d-dc6b78ef6c94} + Commands.KeyVault + + + {c972e3ef-4461-4758-ba31-93e0947b1253} + Commands.RedisCache + + + {69ed499e-6f3c-488f-86b8-b74cfda4d47e} + Commands.Sql + + + {2493a8f7-1949-4f29-8d53-9d459046c3b8} + Commands.Tags + + + {F49A314A-A235-47D3-A654-1EC19ACA366C} + Commands.StreamAnalytics + + + + + Designer + Always + + + PreserveNewest + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + + + + + powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)\PostBuild.ps1" "$(TargetDir)\" + + + + + + + \ No newline at end of file diff --git a/src/ResourceManager/Websites/Commands.Websites/MSSharedLibKey.snk b/src/ResourceManager/Websites/Commands.Websites/MSSharedLibKey.snk new file mode 100644 index 000000000000..695f1b38774e Binary files /dev/null and b/src/ResourceManager/Websites/Commands.Websites/MSSharedLibKey.snk differ diff --git a/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.psd1 b/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.psd1 new file mode 100644 index 000000000000..49a0bd881e67 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.psd1 @@ -0,0 +1,88 @@ +# +# Module manifest for module 'Microsoft.Azure.Commands.Resources' +# +# Generated by: Microsoft Corporation +# +# Generated on: 4/01/2014 +# + +@{ + +# Version number of this module. +ModuleVersion = '0.8.8' + +# ID used to uniquely identify this module +GUID = '81d522a4-6e5d-4105-8f58-376204c47458' + +# Author of this module +Author = 'Microsoft Corporation' + +# Company or vendor of this module +CompanyName = 'Microsoft Corporation' + +# Copyright statement for this module +Copyright = '� Microsoft Corporation. All rights reserved.' + +# Description of the functionality provided by this module +Description = '' + +# Minimum version of the Windows PowerShell engine required by this module +PowerShellVersion = '3.0' + +# Name of the Windows PowerShell host required by this module +PowerShellHostName = '' + +# Minimum version of the Windows PowerShell host required by this module +PowerShellHostVersion = '' + +# Minimum version of the .NET Framework required by this module +DotNetFrameworkVersion = '4.0' + +# Minimum version of the common language runtime (CLR) required by this module +CLRVersion='4.0' + +# Processor architecture (None, X86, Amd64, IA64) required by this module +ProcessorArchitecture = 'None' + +# Modules that must be imported into the global environment prior to importing this module +RequiredModules = @() + +# Assemblies that must be loaded prior to importing this module +RequiredAssemblies = @() + +# Script files (.ps1) that are run in the caller's environment prior to importing this module +ScriptsToProcess = @() + +# Type files (.ps1xml) to be loaded when importing this module +TypesToProcess = @() + +# Format files (.ps1xml) to be loaded when importing this module +FormatsToProcess = @() + +# Modules to import as nested modules of the module specified in ModuleToProcess +NestedModules = @( + '..\..\..\Package\Debug\ResourceManager\AzureResourceManager\Resources\Microsoft.Azure.Commands.Websites.dll' +) + +# Functions to export from this module +FunctionsToExport = '*' + +# Cmdlets to export from this module +CmdletsToExport = '*' + +# Variables to export from this module +VariablesToExport = '*' + +# Aliases to export from this module +AliasesToExport = @() + +# List of all modules packaged with this module +ModuleList = @() + +# List of all files packaged with this module +FileList = @() + +# Private data to pass to the module specified in ModuleToProcess +PrivateData = '' + +} diff --git a/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.xml b/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.xml new file mode 100644 index 000000000000..6973d67d8afd --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Microsoft.Azure.Commands.Websites.dll-Help.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/ResourceManager/Websites/Commands.Websites/PostBuild.ps1 b/src/ResourceManager/Websites/Commands.Websites/PostBuild.ps1 new file mode 100644 index 000000000000..d8b5007e4273 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/PostBuild.ps1 @@ -0,0 +1,33 @@ +# ---------------------------------------------------------------------------------- +# +# 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. +# ---------------------------------------------------------------------------------- + +Write-Output -InputObject 'Starting post-build script'; + +$sourceDir = $args[0]; +Write-Output -InputObject $sourceDir; + +$sourcePath = $sourceDir + "AzureResourceManager.psd1" +$destDir = Split-Path -Path $sourceDir + +if (Test-Path -Path $sourcePath) { + Write-Output -InputObject "Copying '$sourcePath' to directory '$destDir'"; + Copy-Item -Path $sourcePath -Destination $destDir; +} + +if (Test-Path -Path $sourcePath) { + Write-Output "Removing $sourcePath"; + Remove-Item -Path $sourcePath -Force; +} + +Write-Output -InputObject 'Finished post-build script'; \ No newline at end of file diff --git a/src/ResourceManager/Websites/Commands.Websites/Properties/AssemblyInfo.cs b/src/ResourceManager/Websites/Commands.Websites/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..0271e56caa08 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Properties/AssemblyInfo.cs @@ -0,0 +1,34 @@ +// ---------------------------------------------------------------------------------- +// +// 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.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Resource Manager")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("e386b843-f3f0-4db3-8664-37d16b860dde")] +[assembly: AssemblyVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyVersion)] +[assembly: AssemblyFileVersion(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyFileVersion)] +#if SIGN +[assembly: InternalsVisibleTo("Microsoft.Azure.Commands.Resources.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +#else +[assembly: InternalsVisibleTo("Microsoft.Azure.Commands.Resources.Test")] +#endif \ No newline at end of file diff --git a/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.Designer.cs b/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.Designer.cs new file mode 100644 index 000000000000..c35b242f8810 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.Designer.cs @@ -0,0 +1,387 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.Commands.Websites.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.Websites.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Adding resource group.... + /// + internal static string AddingResourceGroup { + get { + return ResourceManager.GetString("AddingResourceGroup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to cancel the active deployment of resource group '{0}'?. + /// + internal static string CancelResourceGroupDeployment { + get { + return ResourceManager.GetString("CancelResourceGroupDeployment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cancelling active resource group deployment .... + /// + internal static string CancelResourceGroupDeploymentMessage { + get { + return ResourceManager.GetString("CancelResourceGroupDeploymentMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find a deployment with name '{0}'.. + /// + internal static string DeploymentWithNameNotFound { + get { + return ResourceManager.GetString("DeploymentWithNameNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot parse {0} '{1}'. + /// + internal static string FailedToParseProperty { + get { + return ResourceManager.GetString("FailedToParseProperty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot set parameter '{0}' from TemplateParameterFile. Incompatible value '{1}'.. + /// + internal static string FailureParsingTemplateParameterFile { + get { + return ResourceManager.GetString("FailureParsingTemplateParameterFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot set parameter '{0}' from TemplateParameterObject. Incompatible value '{1}'.. + /// + internal static string FailureParsingTemplateParameterObject { + get { + return ResourceManager.GetString("FailureParsingTemplateParameterObject", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The provided file path '{0}' already exists, do you want to override it?. + /// + internal static string FileAlreadyExists { + get { + return ResourceManager.GetString("FileAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid format of the resource identifier.. + /// + internal static string InvalidFormatOfResourceId { + get { + return ResourceManager.GetString("InvalidFormatOfResourceId", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid tag format. Expect @{Name = "tagName"} or @{Name = "tagName"; Value = "tagValue"}. + /// + internal static string InvalidTagFormat { + get { + return ResourceManager.GetString("InvalidTagFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = "tagName1"; Value = "tagValue1"}, @{Name = "tagName2"; Value = "tagValue2"}. + /// + internal static string InvalidTagFormatNotUniqueName { + get { + return ResourceManager.GetString("InvalidTagFormatNotUniqueName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find a template with identity '{0}'. Check the template identity and try the command again.. + /// + internal static string InvalidTemplateIdentity { + get { + return ResourceManager.GetString("InvalidTemplateIdentity", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replacing resource group .... + /// + internal static string NewResourceGroupMessage { + get { + return ResourceManager.GetString("NewResourceGroupMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Replacing resource .... + /// + internal static string NewResourceMessage { + get { + return ResourceManager.GetString("NewResourceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find any deployments in resource group '{0}'.. + /// + internal static string NoDeploymentWereFound { + get { + return ResourceManager.GetString("NoDeploymentWereFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Overriding the existing file.. + /// + internal static string OverrdingFile { + get { + return ResourceManager.GetString("OverrdingFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing application .... + /// + internal static string RemoveApplication { + get { + return ResourceManager.GetString("RemoveApplication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing resource group .... + /// + internal static string RemoveResourceGroupMessage { + get { + return ResourceManager.GetString("RemoveResourceGroupMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing resource .... + /// + internal static string RemoveResourceMessage { + get { + return ResourceManager.GetString("RemoveResourceMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing service principal .... + /// + internal static string RemoveServicePrincipal { + get { + return ResourceManager.GetString("RemoveServicePrincipal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove application with object id '{0}'.. + /// + internal static string RemovingApplication { + get { + return ResourceManager.GetString("RemovingApplication", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove resource '{0}'. + /// + internal static string RemovingResource { + get { + return ResourceManager.GetString("RemovingResource", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove resource group '{0}'. + /// + internal static string RemovingResourceGroup { + get { + return ResourceManager.GetString("RemovingResourceGroup", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing role assignment for AD object '{0}' on scope '{1}' with role definition '{2}' . + /// + internal static string RemovingRoleAssignment { + get { + return ResourceManager.GetString("RemovingRoleAssignment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Are you sure you want to remove service principal with object id '{0}'.. + /// + internal static string RemovingServicePrincipal { + get { + return ResourceManager.GetString("RemovingServicePrincipal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Provided resource already exists. Are you sure you want to replace it?. + /// + internal static string ResourceAlreadyExists { + get { + return ResourceManager.GetString("ResourceAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Provided resource does not exist.. + /// + internal static string ResourceDoesntExists { + get { + return ResourceManager.GetString("ResourceDoesntExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Provided resource group already exists. Are you sure you want to update it?. + /// + internal static string ResourceGroupAlreadyExists { + get { + return ResourceManager.GetString("ResourceGroupAlreadyExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Provided resource group does not exist.. + /// + internal static string ResourceGroupDoesntExists { + get { + return ResourceManager.GetString("ResourceGroupDoesntExists", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Provided resource group does not exist. Would you like to create it?. + /// + internal static string ResourceGroupDoesntExistsAdd { + get { + return ResourceManager.GetString("ResourceGroupDoesntExistsAdd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Resource type needs to be in the ResourceProvider/type format. For example Microsoft.Web/sites.. + /// + internal static string ResourceTypeFormat { + get { + return ResourceManager.GetString("ResourceTypeFormat", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Can not find role definition with name '{0}'.. + /// + internal static string RoleDefinitionNotFound { + get { + return ResourceManager.GetString("RoleDefinitionNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service principal with object id '{0}' does not exist.. + /// + internal static string ServicePrincipalDoesntExist { + get { + return ResourceManager.GetString("ServicePrincipalDoesntExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Because the current subscription does not have a current storage account, you must specify the StorageAccountName parameter.. + /// + internal static string StorageAccountNameNeedsToBeSpecified { + get { + return ResourceManager.GetString("StorageAccountNameNeedsToBeSpecified", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Template is valid.. + /// + internal static string TemplateValid { + get { + return ResourceManager.GetString("TemplateValid", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot find Gallery item '{0}'.. + /// + internal static string UnableToFindGallery { + get { + return ResourceManager.GetString("UnableToFindGallery", resourceCulture); + } + } + } +} diff --git a/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.resx b/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.resx new file mode 100644 index 000000000000..8dd2a90cd9e0 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Properties/Resources.resx @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Adding resource group... + + + Are you sure you want to cancel the active deployment of resource group '{0}'? + + + Cancelling active resource group deployment ... + + + Cannot find a deployment with name '{0}'. + + + Cannot parse {0} '{1}' + + + Cannot set parameter '{0}' from TemplateParameterFile. Incompatible value '{1}'. + + + Cannot set parameter '{0}' from TemplateParameterObject. Incompatible value '{1}'. + + + The provided file path '{0}' already exists, do you want to override it? + + + Cannot find a template with identity '{0}'. Check the template identity and try the command again. + + + Replacing resource group ... + + + Replacing resource ... + + + Overriding the existing file. + + + Cannot find any deployments in resource group '{0}'. + + + Removing resource group ... + + + Removing resource ... + + + Are you sure you want to remove resource '{0}' + + + Are you sure you want to remove resource group '{0}' + + + Provided resource already exists. Are you sure you want to replace it? + + + Provided resource does not exist. + + + Provided resource group already exists. Are you sure you want to update it? + + + Provided resource group does not exist. + + + Provided resource group does not exist. Would you like to create it? + + + Resource type needs to be in the ResourceProvider/type format. For example Microsoft.Web/sites. + + + Because the current subscription does not have a current storage account, you must specify the StorageAccountName parameter. + + + Template is valid. + + + Cannot find Gallery item '{0}'. + + + Invalid format of the resource identifier. + + + Invalid tag format. Expect @{Name = "tagName"} or @{Name = "tagName"; Value = "tagValue"} + + + Removing role assignment for AD object '{0}' on scope '{1}' with role definition '{2}' + + + Invalid tag format. Ensure that each tag has a unique name. Example: @{Name = "tagName1"; Value = "tagValue1"}, @{Name = "tagName2"; Value = "tagValue2"} + + + Can not find role definition with name '{0}'. + + + Removing application ... + + + Removing service principal ... + + + Are you sure you want to remove application with object id '{0}'. + + + Are you sure you want to remove service principal with object id '{0}'. + + + Service principal with object id '{0}' does not exist. + + \ No newline at end of file diff --git a/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs b/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs new file mode 100644 index 000000000000..24a27c972859 --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/Utilities/WebsitesClient.cs @@ -0,0 +1,100 @@ +// ---------------------------------------------------------------------------------- +// +// 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.Serialization.Formatters; +using System.Threading; +using Microsoft.Azure.Management.Resources; +using Microsoft.Azure.Commands; +using Microsoft.Azure.Management.WebSites; +using System.Net; + +using Hyak.Common; +using Microsoft.Azure.Common.Extensions.Models; +using Microsoft.Azure.Common.Extensions; +using Microsoft.Azure.Management.WebSites.Models; + +namespace Microsoft.Azure.Commands.Websites.Utilities +{ + + public class WebsitesClient + { + public WebsitesClient(AzureContext context) + { + this.Resourcesclient = AzureSession.ClientFactory.CreateClient(context, AzureEnvironment.Endpoint.ResourceManager); + this.WrappedWebsitesClient = AzureSession.ClientFactory.CreateClient(context, AzureEnvironment.Endpoint.ResourceManager); + + } + public WebSiteManagementClient WrappedWebsitesClient + { + get; + private set; + } + + public ResourceManagementClient Resourcesclient + { + get; + private set; + } + + public WebSite CreateWebsite(string resourceGroupName, string webSiteName, string slotName, string location, string webHostingPlan) + { + var createdWebSite = WrappedWebsitesClient.WebSites.CreateOrUpdate( + resourceGroupName, webSiteName, slotName, + new WebSiteCreateOrUpdateParameters + { + WebSite = new WebSiteBase + { + Name = webSiteName, + Location = location, + Properties = new WebSiteBaseProperties(webHostingPlan) + } + }); + + return createdWebSite.WebSite; + } + + public System.Net.HttpStatusCode StartWebsite(string resourceGroupName, string webSiteName, string slotName) + { + var startedWebsite = WrappedWebsitesClient.WebSites.Start(resourceGroupName, webSiteName, slotName); + return startedWebsite.StatusCode; + } + public System.Net.HttpStatusCode StopWebsite(string resourceGroupName, string webSiteName, string slotName) + { + var stoppedWebsite = WrappedWebsitesClient.WebSites.Stop(resourceGroupName, webSiteName, slotName); + return stoppedWebsite.StatusCode; + } + public System.Net.HttpStatusCode RestartWebsite(string resourceGroupName, string webSiteName, string slotName) + { + var restartedWebsite = WrappedWebsitesClient.WebSites.Restart(resourceGroupName, webSiteName, slotName); + return restartedWebsite.StatusCode; + } + + public System.Net.HttpStatusCode RemoveWebsite(string resourceGroupName, string webSiteName, string slotName, bool deleteEmptyServerFarmBydefault, bool deleteMetricsBydefault, bool deleteSlotsBydefault) + { + WebSiteDeleteParameters webSiteDelParams = new WebSiteDeleteParameters(deleteEmptyServerFarmBydefault, deleteMetricsBydefault, deleteSlotsBydefault); + + var startedWebsite = WrappedWebsitesClient.WebSites.Delete(resourceGroupName, webSiteName, slotName, webSiteDelParams); + return startedWebsite.StatusCode; + } + + + + } +} diff --git a/src/ResourceManager/Websites/Commands.Websites/packages.config b/src/ResourceManager/Websites/Commands.Websites/packages.config new file mode 100644 index 000000000000..cf7eac4d7e1d --- /dev/null +++ b/src/ResourceManager/Websites/Commands.Websites/packages.config @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file