-
Notifications
You must be signed in to change notification settings - Fork 4k
CDN - PowerShell Functionality and Doc Improvements #2687
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
Conversation
Hi @CamSoper, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution!
TTYL, AZPRBOT; |
Can one of the admins verify this patch? |
@azuresdkci add to whitelist |
@@ -9,7 +9,7 @@ | |||
@{ | |||
|
|||
# Version number of this module. | |||
ModuleVersion = '1.0.5' |
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.
please revert this change. It is part of our process to update versions in each release.
Should be fixed now. Sorry about that, @hovsepm ! |
@CamSoper Test failures, looks like some tests need to be re-recorded |
@markcowl Light is green, trap is clean! |
@kuangweizhang - @hovsepm needs you to bless this, please. :) Thanks! |
|
||
var existingCustomDomain = CdnManagementClient.CustomDomains.ListByEndpoint(EndpointName, ProfileName, ResourceGroupName).Where(cd => cd.Name == CustomDomainName).FirstOrDefault(); |
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.
I think we should ignore case when compare the custom domain name
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.
Same comment for other places
Just some comments on comparing the name of the resources, otherwise, LGTM |
Thanks, @kuangweizhang! Implemented the changes as suggested. Should be good to merge, I think. |
$endpointName = "sdktest-cee91bb1-996a-44f1-96e6-dceaa6707def" | ||
$hostName = "sdktest-3acbafc1-3f50-4fa4-9132-6d8c944d67e9.azureedge-test.net" | ||
$customDomainName = getAssetName | ||
$endpointName = "sdktest-b0939e74-75ba-4558-afe6-edc5c19ea713" |
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.
The best practice is to make setup part of test execution, so that these values do not have to be updated whenever the test is re-recorded. Please file an issue to do setup as part of test execution
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.
I get what you're saying, and believe me, I wanted to do this differently too, however the two CustomDomain tests rely on a non-injectable outside resource - a DNS CNAME that must be setup manually on DNS. That's why the original authors ( @kuangweizhang ? Qinyuan? ) did it this way.
@@ -18,38 +18,61 @@ | |||
using Microsoft.Azure.Commands.Cdn.Models.CustomDomain; | |||
using Microsoft.Azure.Commands.Cdn.Properties; | |||
using Microsoft.Azure.Management.Cdn; | |||
using System.Linq; | |||
using Microsoft.Azure.Commands.Cdn.Models.Endpoint; | |||
|
|||
namespace Microsoft.Azure.Commands.Cdn.CustomDomain | |||
{ | |||
[Cmdlet(VerbsCommon.Get, "AzureRmCdnCustomDomain"), OutputType(typeof(PSCustomDomain))] | |||
public class GetAzureRmCdnCustomDomain : AzureCdnCmdletBase |
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.
For all cmdlets where you are adding a parameter set - you need to have a DefaultParameterSetName promprty in your Cmdlet attribute. And to avoid breaks, this should match the parameter set name containign the previous cmdlet parameters
@CamSoper Some comments, three things that apply across the board: (1) Your remove cmdlets must not use the pattern Force || ShouldProcess, this prevents ConfirmPreference and WhatIf parameters from working correctly. The best option would be to remove the ConfirmImpact.High and simply use ShouldProcess to determine whether a prompt occurs. This doesn't show a prompt unless the user asks for it bu lowering ConfirmPreference or specifying -Confirm. A less good option would be to remove ConfirmImpact.High and use
This acts as above, except that, in addition, the ShouldContinue prompt always occurs unless the user specifies - Force. (2) For any cmdlet where you have added a parameter set, the DefaultParameterSetName property og the Cmdlet attribute should be set to the old parameter set, this avoids breaking changes (and you should always have a default parameter set if there is more thna one) (3) For any cmdlet you ar5e changing that makes a change or has side effects, I have asked for supporting the SHouldProcess pattern - this allows users to execute the cmdlet with -WhatIf to determine what it would do if executed. |
…f profile with existing endpoints.
Adjusted tests for better code coverage
on demand run here:http://azuresdkci.cloudapp.net/view/1-AzurePowerShell/job/powershell-demand/1058/ LGTM once the tests pass. |
Made a ton of improvements for usability and documentation.
Get-AzureRmCdnProfile
now returns all profiles a user has access to.Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint
will list all endpoints on all profiles a user has access to.Get-AzureRmCdnProfile | Get-AzureRmCdnEndpoint | Get-AzureRmCdnCustomDomain
will list all the custom domains. Etc., etc.Still to-do: The help XML needs Examples.
@kuangweizhang