Skip to content

Conversation

@murilogr
Copy link
Contributor

Description

https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/29

Checklist

Copy link
Member

@cormacpayne cormacpayne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr a few comments for you to take a look at. If you have any questions about the piping scenarios I touched on, please refer to this document.


if(!string.IsNullOrEmpty(this.Name))
{
var vDdosProtectionPlan = this.NetworkClient.NetworkManagementClient.DdosProtectionPlans.Get(ResourceGroupName, Name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr does this Get method handle when ResourceGroupName is null? If not, we should have two parameter sets to prevent the user from providing Name without ResourceGroupName:

  • One set with an optional ResourceGroupName parameter
  • One set with mandatory ResourceGroupName and Name parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and it validates it:

PS D:\azure-powershell> Get-AzureRmDdosProtectionPlan -Name  DdosProtectionPlanName
Get-AzureRmDdosProtectionPlan : 'resourceGroupName' cannot be null.
At line:1 char:1
+ Get-AzureRmDdosProtectionPlan -Name  DdosProtectionPlanName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Get-AzureRmDdosProtectionPlan], ValidationException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.Automation.GetAzureRmDdosProtectionPlan

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr the idea is that we don't have a scenario that leads users to get this error ☺️ if we have the split parameter sets where the user provides both ResourceGroupName and Name or an optional ResourceGroupName, then there is no situation where they'd get this error because they'd never be able to provide just the Name parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed :) Added parameter sets

namespace Microsoft.Azure.Commands.Network.Automation
{
[Cmdlet(VerbsCommon.Get, "AzureRmDdosProtectionPlan"), OutputType(typeof(PSDdosProtectionPlan))]
public partial class GetAzureRmDdosProtectionPlan : NetworkBaseCmdlet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr is this a tracked resource? If so, we should add an additional parameter set that allows the user to pass just ResourceId, and you can use common code to strip out the ResourceGroupName and Name. This allows users to call Get-AzureRmResource and pipe the result to this cmdlet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by tracked resource?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr is this a resource that has a ResourceId that the user can retrieve from a generic REST call? (i.e., using Get-AzureRmResource -- check out this doc)

[Parameter(
Mandatory = false,
HelpMessage = "Do not ask for confirmation if you want to overwrite a resource")]
public SwitchParameter Force { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr is this Force parameter necessary? The Force parameter should only be needed when you prompt the user for additional confirmation during cmdlet execution. If you are not doing this, then you shouldn't need the Force parameter


namespace Microsoft.Azure.Commands.Network
{
[Cmdlet(VerbsCommon.Remove, "AzureRmDdosProtectionPlan", SupportsShouldProcess = true)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr please ensure that this cmdlet has an output type (in this case bool)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has when I use PassThru parameter.

[Parameter(
Mandatory = false,
HelpMessage = "Do not ask for confirmation if you want to delete resource.")]
public SwitchParameter Force { get; set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr same comment about if we need the Force parameter

Gets an application security group.

### [Get-AzureRmBgpServiceCommunity](Get-AzureRmBgpServiceCommunity.md)
{{Manually Enter Get-AzureRmBgpServiceCommunity Description Here}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr would you mind adding a description for this cmdlet since it was removed? (you can just use the description of the cmdlet if it has one)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

---
external help file: Microsoft.Azure.Commands.Network.dll-Help.xml
Module Name: AzureRM.Network
online version:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr please refer to the ValidateHelpIssues.csv file that is a part of your Jenkins build for information about how to resolve the build errors around your help files


### Example 1: Get a specific DDoS protection plan
```
Get-AzureRmDdosProtectionPlan -ResourceGroupName ResourceGroupName -Name DdosProtectionPlanName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr for each of the examples you are providing, please add the corresponding output that the user would see

---
external help file: Microsoft.Azure.Commands.Network.dll-Help.xml
Module Name: AzureRM.Network
online version:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr same comments in this file about build failures and output for the examples

---
external help file: Microsoft.Azure.Commands.Network.dll-Help.xml
Module Name: AzureRM.Network
online version:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@murilogr same comment in this file about build failures and example output

Nilambari added a commit to Nilambari/azure-powershell that referenced this pull request Apr 27, 2018
@Nilambari
Copy link
Member

Merged this PR into PR:- #5993

@markcowl
Copy link
Member

closing in favor of #5993

@markcowl markcowl closed this Apr 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants