Skip to content

Adding aliases to a few cmdlets and updating help documentation to match #4110

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

Merged
merged 3 commits into from
Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/ResourceManager/Sql/Commands.Sql/Common/Constants.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// ----------------------------------------------------------------------------------
//
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Sql.Common
{
public class Constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class GetAzureSqlDatabase : AzureSqlDatabaseCmdletBase<IEnumerable<AzureS
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Database to retrieve.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string DatabaseName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class NewAzureSqlDatabase : AzureSqlDatabaseCmdletBase<AzureSqlDatabaseCr
/// </summary>
[Parameter(Mandatory = true,
HelpMessage = "The name of the Azure SQL Database to create.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string DatabaseName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class RemoveAzureSqlDatabase : AzureSqlDatabaseCmdletBase<IEnumerable<Azu
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Database to remove.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string DatabaseName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class SetAzureSqlDatabase : AzureSqlDatabaseCmdletBase<IEnumerable<AzureS
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Database.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string DatabaseName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class GetAzureSqlElasticPool : AzureSqlElasticPoolCmdletBase
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Elastic Pool to retrieve.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ElasticPoolName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class NewAzureSqlElasticPool : AzureSqlElasticPoolCmdletBase
/// </summary>
[Parameter(Mandatory = true,
HelpMessage = "The name of the Azure SQL ElasticPool to create.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ElasticPoolName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class RemoveAzureSqlElasticPool : AzureSqlElasticPoolCmdletBase
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Elastic Pool to remove.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ElasticPoolName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class SetAzureSqlElasticPool : AzureSqlElasticPoolCmdletBase
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure SQL Elastic Pool.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ElasticPoolName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class GetAzureSqlServerFirewallRule : AzureSqlServerFirewallRuleCmdletBas
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The Azure Sql Database Server Firewall Rule name.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string FirewallRuleName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class NewAzureSqlServerFirewallRule : AzureSqlServerFirewallRuleCmdletBas
[Parameter(Mandatory = true,
HelpMessage = "Azure Sql Database Server Firewall Rule Name.",
ParameterSetName = UserSpecifiedRuleSet)]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string FirewallRuleName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class RemoveAzureSqlServerFirewallRule : AzureSqlServerFirewallRuleCmdlet
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "Azure Sql Database Server Firewall Rule name")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string FirewallRuleName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class SetAzureSqlServerFirewallRule : AzureSqlServerFirewallRuleCmdletBas
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "The name of the Azure Sql Database Server Firewall Rule.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string FirewallRuleName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class GetAzureSqlServer : AzureSqlServerCmdletBase, IModuleAssemblyInitia
ValueFromPipelineByPropertyName = true,
Position = 1,
HelpMessage = "SQL Database server name.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class NewAzureSqlServer : AzureSqlServerCmdletBase
/// </summary>
[Parameter(Mandatory = true,
HelpMessage = "SQL Database server name.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class RemoveAzureSqlServer : AzureSqlServerCmdletBase
ValueFromPipelineByPropertyName = true,
Position = 1,
HelpMessage = "SQL Database server name.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class SetAzureSqlServer : AzureSqlServerCmdletBase
ValueFromPipelineByPropertyName = true,
Position = 1,
HelpMessage = "SQL Database server name.")]
[Alias("Name")]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,37 @@
using Microsoft.Azure.Commands.Sql.ServiceObjective.Adapter;
using Microsoft.Azure.Commands.Sql.ServiceObjective.Model;
using System.Collections.Generic;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.Sql.ServiceObjective.Cmdlet
{
public abstract class AzureSqlServerServiceObjectiveCmdletBase
: AzureSqlDatabaseCmdletBase<IEnumerable<AzureSqlServerServiceObjectiveModel>, AzureSqlServerServiceObjectiveAdapter>
: AzureSqlCmdletBase<IEnumerable<AzureSqlServerServiceObjectiveModel>, AzureSqlServerServiceObjectiveAdapter>
{
/// <summary>
/// Gets or sets the name of the database server to use.
/// </summary>
[Parameter(Mandatory = true,
ValueFromPipelineByPropertyName = true,
Position = 1,
HelpMessage = "SQL Database server name.")]
[ValidateNotNullOrEmpty]
public string ServerName { get; set; }

/// <summary>
/// Gets or sets the name of the database to use.
/// </summary>
/// <remarks>
/// This parameter is not needed or used. It will be removed in a future release.
/// </remarks>
[Parameter(Mandatory = false,
ValueFromPipelineByPropertyName = true,
Position = 2,
HelpMessage = "SQL Database name.",
DontShow = true)]
[ValidateNotNullOrEmpty]
public string DatabaseName { get; set; }

/// <summary>
/// Intializes the model adapter
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Adds one or more databases to an Azure SQL Database Failover Group.
## SYNTAX

```
Add-AzureRmSqlDatabaseToFailoverGroup -ServerName <String> -FailoverGroupName <String>
Add-AzureRmSqlDatabaseToFailoverGroup [-ServerName] <String> [-FailoverGroupName] <String>
-Database <System.Collections.Generic.List`1[Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel]>
-ResourceGroupName <String> [<CommonParameters>]
[-ResourceGroupName] <String> [<CommonParameters>]
```

## DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Sql/Commands.Sql/help/AzureRM.Sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Locale: en-US

# AzureRM.Sql Module
## Description
This topic displays help topics for the [Azure SQL Database](https://docs.microsoft.com/azure/sql-database/) Cmdlets.
Copy link
Member

Choose a reason for hiding this comment

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

@akromm I think this was a change that was recently made. Do we want to revert it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, thank you for catching. Where is the source for this comment? I'd like to change it at the source so that future re-generation of this file doesn't cause this.

Copy link
Member

Choose a reason for hiding this comment

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

@akromm I was under the impression that this was the source. Do you remember the command you used to regenerate the markdown help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cormacpayne I used platyPS:
$pathToHelpFolder = "E:\git\azure-powershell\src\ResourceManager\Sql\Commands.Sql\help"
Update-MarkdownHelpModule -Path $PathToHelpFolder -RefreshModulePage -AlphabeticParamsOrder

Copy link
Member

Choose a reason for hiding this comment

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

@akromm that's the correct command. I would assume this is an issue with how platyPS parses the markdown (maybe it can't handle links?). I can investigate myself and open an issue in their repository if necessary.

This topic displays help topics for the Azure SQL Database Cmdlets.

## AzureRM.Sql Cmdlets
### [Add-AzureRmSqlDatabaseToFailoverGroup](Add-AzureRmSqlDatabaseToFailoverGroup.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## RELATED LINKS



Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Specifies the name of the database to retrieve.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: Name

Required: False
Position: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## RELATED LINKS



Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## RELATED LINKS



Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## RELATED LINKS



Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Specifies the name of the elastic pool that this cmdlet gets.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: Name

Required: False
Position: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,3 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

## RELATED LINKS



Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Specifies the name of the server that this cmdlet gets.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: Name

Required: False
Position: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Specifies the name of the firewall rule.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: Name

Required: False
Position: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Gets service objectives for an Azure SQL Database server.

```
Get-AzureRmSqlServerServiceObjective [[-ServiceObjectiveName] <String>] [-ServerName] <String>
[-DatabaseName] <String> [-ResourceGroupName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
[[-DatabaseName] <String>] [-ResourceGroupName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -55,7 +55,7 @@ Type: String
Parameter Sets: (All)
Aliases:

Required: True
Required: False
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Expand Down
38 changes: 19 additions & 19 deletions src/ResourceManager/Sql/Commands.Sql/help/New-AzureRmSqlDatabase.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Specifies the name of the database.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Aliases: Name

Required: True
Position: Named
Expand Down Expand Up @@ -169,7 +169,7 @@ Specifies the maximum size of the database in bytes.
```yaml
Type: Int64
Parameter Sets: (All)
Aliases:
Aliases:
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is auto generated so I'd rather leave it.


Required: False
Position: Named
Expand Down Expand Up @@ -224,6 +224,22 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -SampleName
The name of the sample schema to apply when creating this database.

```yaml
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: AdventureWorksLT

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -ServerName
Specifies the name of the server that hosts the database.

Expand Down Expand Up @@ -285,24 +301,8 @@ Accept pipeline input: False
Accept wildcard characters: False
```

### -SampleName
The name of the sample schema to apply when creating this database.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cormacpayne how do I make the generated markdown include the missing '[' and ']' ?

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@akromm I'd have to look, but I think a previously opened PR made the change to wrap the about_CommonParameters text in the '[' and ']' brackets

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cormacpayne correct, a previous PR added in the enclosed brackets to make the text a link. I would like to keep it that way during future re-generation of the doc files.

What are your thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

@akromm I agree, it would make it much nicer to view in markdown. I can also talk to the platyPS team about how we can prevent this from getting overridden in the future, since it seems to be a hard-coded string that they use for when a cmdlet uses the above set of verbs.


## INPUTS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ This command creates a new Azure SQL Database Failover Group.
## SYNTAX

```
New-AzureRmSqlDatabaseFailoverGroup -ServerName <String> -FailoverGroupName <String>
New-AzureRmSqlDatabaseFailoverGroup [-ServerName] <String> -FailoverGroupName <String>
[-PartnerResourceGroupName <String>] -PartnerServerName <String> [-FailoverPolicy <FailoverPolicy>]
[-GracePeriodWithDataLossHours <Int32>] -ResourceGroupName <String> [<CommonParameters>]
[-GracePeriodWithDataLossHours <Int32>] [-AllowReadOnlyFailoverToPrimary <AllowReadOnlyFailoverToPrimary>]
[-ResourceGroupName] <String> [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -51,6 +52,7 @@ Whether an outage on the secondary server should trigger automatic failover of t
Type: AllowReadOnlyFailoverToPrimary
Parameter Sets: (All)
Aliases:
Accepted values: Enabled, Disabled

Required: False
Position: Named
Expand Down
Loading