-
Notifications
You must be signed in to change notification settings - Fork 4k
Changed the parameter WebsiteName to Name to use in piping. Added publis... #268
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
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
| ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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 get the publishing creds of the given Azure Websites using ARM APIs | ||
/// </summary> | ||
[Cmdlet(VerbsCommon.Get, "AzureWebsitePublishingProfile")] | ||
public class GetAzureWebsitePublishingProfileCmdlet : WebsiteBaseSlotCmdlet | ||
{ | ||
public override void ExecuteCmdlet() | ||
{ | ||
WriteObject(WebsitesClient.GetWebsitePublishingProfile(ResourceGroupName, Name, SlotName)); | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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 Microsoft.Azure.Commands.Websites.Models; | ||
using System.Management.Automation; | ||
using Microsoft.Azure.Commands.Websites.Models.Websites; | ||
|
||
namespace Microsoft.Azure.Commands.Websites | ||
{ | ||
public class WebsiteBaseNotMandatoryCmdlet : WebsitesBaseClient | ||
{ | ||
[Parameter(Position = 0, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the resource group.")] | ||
[ValidateNotNullOrEmptyAttribute] | ||
public string ResourceGroupName { get; set; } | ||
|
||
[Parameter(Position = 1, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The name of the website.")] | ||
[ValidateNotNullOrEmptyAttribute] | ||
public string Name { get; set; } | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// ---------------------------------------------------------------------------------- | ||
// | ||
// 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 Microsoft.Azure.Commands.Websites.Models; | ||
using System.Management.Automation; | ||
using Microsoft.Azure.Commands.Websites.Models.Websites; | ||
|
||
namespace Microsoft.Azure.Commands.Websites | ||
{ | ||
public class WebsiteBaseSlotCmdlet : WebsitesBaseClient | ||
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. should derive from WebsiteBaseCmdlet 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. Changed this with other changes in the pipe will update in next pull |
||
{ | ||
[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 Name { get; set; } | ||
|
||
[Parameter(Position = 2, Mandatory = false, HelpMessage = "The name of the website slot.")] | ||
[ValidateNotNullOrEmptyAttribute] | ||
public string SlotName { get; set; } | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,58 +92,79 @@ public System.Net.HttpStatusCode RemoveWebsite(string resourceGroupName, string | |
public WebSite GetWebsite(string resourceGroupName, string webSiteName, string slotName) | ||
{ | ||
WebSiteGetParameters webSiteGetParams = new WebSiteGetParameters(); | ||
|
||
var getWebsite = WrappedWebsitesClient.WebSites.Get(resourceGroupName, webSiteName, slotName, webSiteGetParams); | ||
try | ||
{ | ||
var getAppSettings = WrappedWebsitesClient.WebSites.GetAppSettings(resourceGroupName, webSiteName, slotName); | ||
//Add websiteApp Settings to the Website object as the Get call will not return them. | ||
foreach (var appSettingVal in getAppSettings.Resource.Properties.ToList()) | ||
{ | ||
if (!getWebsite.WebSite.Properties.Properties.AppSettings.Keys.Contains(appSettingVal.Name)) | ||
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. why do you need this check? 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. also if you do its missing {} 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.
|
||
getWebsite.WebSite.Properties.Properties.AppSettings.Add(appSettingVal.Name, appSettingVal.Value); | ||
} | ||
} | ||
catch | ||
{ | ||
//ignore if this call fails as it will for reader RBAC | ||
} | ||
//Add ConnectionStrings Settings to the Website object as the Get call will not return them. | ||
|
||
try | ||
{ | ||
var getConnectionStringsSettings = WrappedWebsitesClient.WebSites.GetConnectionStrings(resourceGroupName, webSiteName, slotName); | ||
//TODO: Add ConnectionStrings Settings to the Website object as the Get call will not return them. | ||
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 should either use 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. its in TODO: waiting on a modified website object will update tomorrow. |
||
|
||
|
||
} | ||
catch | ||
{ | ||
//ignore if this call fails as it will for reader RBAC | ||
} | ||
|
||
return getWebsite.WebSite; | ||
} | ||
|
||
public WebSiteGetPublishProfileResponse GetWebsitePublishingProfile(string resourceGroupName, string webSiteName, string slotName) | ||
{ | ||
var pubCreds = WrappedWebsitesClient.WebSites.GetPublishProfile(resourceGroupName, webSiteName, slotName); | ||
return pubCreds; | ||
} | ||
|
||
public WebHostingPlanCreateOrUpdateResponse CreateWebHostingPlan(string resourceGroupName, string whpName, string location, string adminSiteName, int numberOfWorkers, SkuOptions sku, WorkerSizeOptions workerSize) | ||
{ | ||
|
||
|
||
WebHostingPlanProperties webHostingPlanProperties = new WebHostingPlanProperties(); | ||
webHostingPlanProperties.Sku = sku; | ||
webHostingPlanProperties.AdminSiteName = adminSiteName; | ||
webHostingPlanProperties.NumberOfWorkers = numberOfWorkers; | ||
webHostingPlanProperties.WorkerSize = workerSize; | ||
|
||
WebHostingPlan webHostingPlan = new WebHostingPlan(); | ||
|
||
WebHostingPlan webHostingPlan = new WebHostingPlan(); | ||
WebHostingPlanCreateOrUpdateParameters webHostingPlanCreateOrUpdateParameters = new WebHostingPlanCreateOrUpdateParameters(webHostingPlan); | ||
webHostingPlanCreateOrUpdateParameters.WebHostingPlan.Location = location; | ||
webHostingPlanCreateOrUpdateParameters.WebHostingPlan.Name = whpName; | ||
webHostingPlanCreateOrUpdateParameters.WebHostingPlan.Properties = webHostingPlanProperties; | ||
|
||
var createdWHP = WrappedWebsitesClient.WebHostingPlans.CreateOrUpdate(resourceGroupName, webHostingPlanCreateOrUpdateParameters); | ||
|
||
//proper return type need to be discussed | ||
return createdWHP; | ||
} | ||
|
||
public AzureOperationResponse RemoveWebHostingPlan(string resourceGroupName, string whpName) | ||
{ | ||
|
||
var response = WrappedWebsitesClient.WebHostingPlans.Delete(resourceGroupName, whpName); | ||
|
||
//proper return type need to be discussed | ||
return response; | ||
} | ||
|
||
public WebHostingPlanGetResponse GetWebHostingPlan(string resourceGroupName, string whpName) | ||
{ | ||
|
||
var response = WrappedWebsitesClient.WebHostingPlans.Get(resourceGroupName, whpName); | ||
|
||
//proper return type need to be discussed | ||
return response; | ||
} | ||
|
||
public WebHostingPlanListResponse ListWebHostingPlan(string resourceGroupName) | ||
{ | ||
|
||
{ | ||
var response = WrappedWebsitesClient.WebHostingPlans.List(resourceGroupName); | ||
|
||
//proper return type need to be discussed | ||
return response; | ||
} | ||
|
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.
not really related to this change but I think that
WebsitesBaseClient
should be renamed as it's misleading, it is actually a Cmdlet and not a Client (only holds a client).