-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Initial commit for the Websites commandlets for ARM #154
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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; | ||
|
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you have some extra \n throughout
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removed |
||
| namespace Microsoft.Azure.Commands.Websites.Cmdlets | ||
| { | ||
| /// <summary> | ||
| /// this commandlet will let you create a new Azure Websites using ARM APIs | ||
| /// </summary> | ||
| [Cmdlet(VerbsCommon.New, "AzureWebsite")] | ||
| public class NewAzureWebsiteCmdlet : WebsiteBaseCmdlet | ||
| { | ||
|
|
||
| [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; } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens when the web hosting plan doesnt exist?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whatever error I get from API that is returned. |
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra \n |
||
| public override void ExecuteCmdlet() | ||
| { | ||
| WriteObject(WebsitesClient.CreateWebsite(ResourceGroupName, WebsiteName, SlotName, Location, WebHostingPlan)); | ||
|
|
||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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; | ||
| using Microsoft.WindowsAzure.Commands.Utilities.Properties; | ||
|
|
||
|
|
||
| namespace Microsoft.Azure.Commands.Websites.Cmdlets | ||
| { | ||
| /// <summary> | ||
| /// this commandlet will let you delete an Azure website | ||
| /// </summary> | ||
| [Cmdlet(VerbsCommon.Remove, "AzureWebsite")] | ||
| public class RemoveAzureWebsiteCmdlet : WebsiteBaseCmdlet | ||
| { | ||
|
|
||
| //always delete the slots, | ||
| private bool deleteSlotsByDefault = true; | ||
|
|
||
| // leave behind the empty webhosting plan | ||
| private bool deleteEmptyServerFarmByDefault = false; | ||
|
|
||
| //always delete the metrics | ||
| private bool deleteMetricsByDefault = true; | ||
|
|
||
| [Parameter(Mandatory = false, HelpMessage = "Do not ask for confirmation.")] | ||
| public SwitchParameter Force { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| string slotName = null; | ||
|
|
||
| ConfirmAction( | ||
| Force.IsPresent, | ||
| string.Format(Resources.RemoveWebsiteWarning, WebsiteName), | ||
| Resources.RemoveWebsiteMessage, | ||
| WebsiteName, | ||
| () => WebsitesClient.RemoveWebsite(ResourceGroupName, WebsiteName, slotName, deleteEmptyServerFarmByDefault, deleteMetricsByDefault, deleteSlotsByDefault)); | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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 | ||
| { | ||
| /// <summary> | ||
| /// this commandlet will let you restart an Azure Website | ||
| /// </summary> | ||
| [Cmdlet(VerbsLifecycle.Restart, "AzureWebsite")] | ||
| public class RestartAzureWebsiteCmdlet : WebsiteBaseCmdlet | ||
| { | ||
|
|
||
| [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] | ||
| [ValidateNotNullOrEmptyAttribute] | ||
| public string SlotName { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| WriteObject(WebsitesClient.RestartWebsite(ResourceGroupName, WebsiteName, SlotName)); | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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 | ||
| { | ||
| /// <summary> | ||
| /// this commandlet will let you Start an Azure Website | ||
| /// </summary> | ||
| [Cmdlet(VerbsLifecycle.Start, "AzureWebsite")] | ||
| public class StartAzureWebsiteCmdlet : WebsiteBaseCmdlet | ||
| { | ||
|
|
||
| [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] | ||
| [ValidateNotNullOrEmptyAttribute] | ||
| public string SlotName { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| WriteObject(WebsitesClient.StartWebsite(ResourceGroupName, WebsiteName, SlotName)); | ||
|
|
||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| | ||
| // ---------------------------------------------------------------------------------- | ||
| // | ||
| // 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 | ||
| { | ||
| /// <summary> | ||
| /// this commandlet will let you stop an Azure Website | ||
| /// </summary> | ||
| [Cmdlet(VerbsLifecycle.Stop, "AzureWebsite")] | ||
| public class StopAzureWebsiteCmdlet : WebsiteBaseCmdlet | ||
| { | ||
|
|
||
| [Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] | ||
| [ValidateNotNullOrEmptyAttribute] | ||
| public string SlotName { get; set; } | ||
|
|
||
| public override void ExecuteCmdlet() | ||
| { | ||
| WriteObject(WebsitesClient.StopWebsite(ResourceGroupName, WebsiteName, SlotName)); | ||
| } | ||
|
|
||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you remove this project?