Skip to content

Commit

Permalink
Merge pull request #3 from gaurangisaxena/gasaxena/powershell
Browse files Browse the repository at this point in the history
resolve comments
  • Loading branch information
gaurangisaxena authored Jul 23, 2019
2 parents a33b1d4 + ddec731 commit 96c8367
Show file tree
Hide file tree
Showing 41 changed files with 69 additions and 210 deletions.
2 changes: 0 additions & 2 deletions src/DataShare/DataShare/Account/GetAzDataShareAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public class GetAzDataShareAccount : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ResourceGroupCompleter()]
Expand All @@ -58,7 +57,6 @@ public class GetAzDataShareAccount : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ResourceNameCompleter(ResourceTypes.Account, "ResourceGroupName")]
Expand Down
6 changes: 4 additions & 2 deletions src/DataShare/DataShare/Account/NewAzDataShareAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace Microsoft.Azure.Commands.DataShare.Account
{
using System;
using System.Collections;
using System.Management.Automation;
using Microsoft.Azure.Commands.DataShare.Common;
Expand All @@ -40,7 +41,6 @@ public class NewAzDataShareAccount : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account will be created in.")]
[ResourceGroupCompleter()]
public string ResourceGroupName { get; set; }
Expand Down Expand Up @@ -71,9 +71,11 @@ public class NewAzDataShareAccount : AzureDataShareCmdletBase
[Parameter]
public SwitchParameter AsJob { get; set; }

private const string ResourceType = "DataShare Account";

public override void ExecuteCmdlet()
{
if (this.ShouldProcess(this.Name, "Creating data share account"))
if (this.ShouldProcess(this.Name, string.Format(Resources.ResourceCreateMessage, NewAzDataShareAccount.ResourceType)))
{
Account dataShareAccount = this.DataShareManagementClient.Accounts.Create(
this.ResourceGroupName,
Expand Down
3 changes: 0 additions & 3 deletions src/DataShare/DataShare/Account/RemoveAzDataShareAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class RemoveAzDataShareAccount : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ParameterSetNames.FieldsParameterSet,
HelpMessage = "The resource group name of azure data share account.")]
[ResourceGroupCompleter()]
Expand All @@ -55,7 +54,6 @@ public class RemoveAzDataShareAccount : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ParameterSetNames.FieldsParameterSet,
HelpMessage = "Azure data share account name.")]
[ValidateNotNullOrEmpty]
Expand Down Expand Up @@ -87,7 +85,6 @@ public class RemoveAzDataShareAccount : AzureDataShareCmdletBase

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Return object (if specified).")]
public SwitchParameter PassThru { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/DataShare/DataShare/Az.DataShare.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ PrivateData = @{
ReleaseNotes = '* Added new Powershell cmdlets for Enable/Disable Custom Domain Https and deprecated the old ones'

# Prerelease string of this module
Prerelease = 'preview'
# Prerelease = 'preview'

# Flag to indicate whether the module requires explicit user acceptance for install/update
# RequireLicenseAcceptance = $false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class GetAzDataShareReceivedInvitation : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share invitation location.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -53,7 +52,6 @@ public class GetAzDataShareReceivedInvitation : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure dataShare invitation id.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand Down
4 changes: 0 additions & 4 deletions src/DataShare/DataShare/DataSet/GetAzDataShareDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class GetAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ResourceGroupCompleter()]
Expand All @@ -53,7 +52,6 @@ public class GetAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -65,7 +63,6 @@ public class GetAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -77,7 +74,6 @@ public class GetAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data set name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand Down
29 changes: 6 additions & 23 deletions src/DataShare/DataShare/DataSet/NewAzDataShareDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Microsoft.Azure.Commands.DataShare.DataSet
using System.Management.Automation;
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;

/// <summary>
/// Defines the New-DataShareDataSet cmdlet.
Expand All @@ -40,17 +41,14 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of the azure data share account",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ResourceGroupCompleter()]
Expand All @@ -61,17 +59,14 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -83,17 +78,14 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share name",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share name",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share name",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -105,17 +97,14 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data set name",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data set name",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data set name",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand Down Expand Up @@ -148,7 +137,6 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage account container name",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -159,7 +147,6 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure ADLS gen2 file system name",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -170,12 +157,10 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage file path",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage file path",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -186,12 +171,10 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage folder path",
ParameterSetName = ParameterSetNames.BlobDataSetParameterSet)]
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage folder path",
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
public string FolderPath { get; set; }
Expand All @@ -201,7 +184,6 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage ADLS gen1 file name",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -212,12 +194,13 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure storage ADLS gen1 folder path",
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
[ValidateNotNullOrEmpty]
public string AdlsGen1FolderPath { get; set; }

private const string ResourceType = "DataSet";

public override void ExecuteCmdlet()
{
var parsedStorageResourceId = new ResourceIdentifier(this.StorageAccountResourceId);
Expand All @@ -229,7 +212,7 @@ public override void ExecuteCmdlet()
ParameterSetNames.BlobDataSetParameterSet,
StringComparison.OrdinalIgnoreCase))
{
if (this.ShouldProcess(this.Name, "Creating data set"))
if (this.ShouldProcess(this.Name, string.Format(Resources.ResourceCreateMessage, NewAzDataShareDataSet.ResourceType)))
{
if (this.FilePath != null)
{
Expand Down Expand Up @@ -297,7 +280,7 @@ public override void ExecuteCmdlet()
StringComparison.OrdinalIgnoreCase))
{

if (this.ShouldProcess(this.Name, "Creating data set"))
if (this.ShouldProcess(this.Name, string.Format(Resources.ResourceCreateMessage, NewAzDataShareDataSet.ResourceType)))
{
if (this.FilePath != null)
{
Expand Down Expand Up @@ -365,7 +348,7 @@ public override void ExecuteCmdlet()
StringComparison.OrdinalIgnoreCase))
{
storageAccountName = parsedStorageResourceId.GetAccountName();
if (this.ShouldProcess(this.Name, "Creating data set"))
if (this.ShouldProcess(this.Name, string.Format(Resources.ResourceCreateMessage, NewAzDataShareDataSet.ResourceType)))
{
if (this.FileName != null)
{
Expand Down
4 changes: 0 additions & 4 deletions src/DataShare/DataShare/DataSet/RemoveAzDataShareDataSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class RemoveAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ParameterSetNames.FieldsParameterSet,
HelpMessage = "The resource group name of the azure data share account.")]
[ResourceGroupCompleter()]
Expand All @@ -53,7 +52,6 @@ public class RemoveAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ParameterSetNames.FieldsParameterSet,
HelpMessage = "Azure data share account name.")]
[ValidateNotNullOrEmpty]
Expand All @@ -65,7 +63,6 @@ public class RemoveAzDataShareDataSet : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ParameterSetName = ParameterSetNames.FieldsParameterSet,
HelpMessage = "Azure data share name.")]
[ValidateNotNullOrEmpty]
Expand Down Expand Up @@ -109,7 +106,6 @@ public class RemoveAzDataShareDataSet : AzureDataShareCmdletBase

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Return object (if specified).")]
public SwitchParameter PassThru { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class GetAzDataShareDataSetMapping : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "The resource group name of azure data share account.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ResourceGroupCompleter()]
Expand All @@ -53,7 +52,6 @@ public class GetAzDataShareDataSetMapping : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share account name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -66,7 +64,6 @@ public class GetAzDataShareDataSetMapping : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = true,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data share subscription name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand All @@ -78,7 +75,6 @@ public class GetAzDataShareDataSetMapping : AzureDataShareCmdletBase
/// </summary>
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Azure data set mapping name.",
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
[ValidateNotNullOrEmpty]
Expand Down
Loading

0 comments on commit 96c8367

Please sign in to comment.