Skip to content

Commit bdc3403

Browse files
authored
Merge pull request #1 from gaurangisaxena/makadiri/comments
removed confirm action and resolved comments
2 parents 7b5a4eb + e18a1f2 commit bdc3403

17 files changed

+53
-98
lines changed

src/DataShare/DataShare/Account/NewAzDataShareAccount.cs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public class NewAzDataShareAccount : AzureDataShareCmdletBase
5050
/// </summary>
5151
[Parameter(Mandatory = true, HelpMessage = "Azure data share account name.")]
5252
[ValidateNotNullOrEmpty]
53-
[ResourceNameCompleter(ResourceTypes.Account, "ResourceGroupName")]
5453
public string Name { get; set; }
5554

5655
/// <summary>
@@ -74,22 +73,15 @@ public class NewAzDataShareAccount : AzureDataShareCmdletBase
7473

7574
public override void ExecuteCmdlet()
7675
{
77-
this.ConfirmAction(
78-
string.Format(Resources.ResourceCreateConfirmation, this.Name),
79-
this.Name,
80-
this.NewAccount);
81-
}
82-
83-
private void NewAccount()
84-
{
85-
if (this.ShouldProcess(this.Name, "Create"))
76+
if (this.ShouldProcess(this.Name, "Creating data share account"))
8677
{
8778
Account dataShareAccount = this.DataShareManagementClient.Accounts.Create(
8879
this.ResourceGroupName,
8980
this.Name,
9081
new Account()
9182
{
92-
Location = this.Location, Tags = this.Tag?.ToDictionaryTags(),
83+
Location = this.Location,
84+
Tags = this.Tag?.ToDictionaryTags(),
9385
Identity = new Identity
9486
{
9587
Type = "SystemAssigned"

src/DataShare/DataShare/DataSet/NewAzDataShareDataSet.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
119119
HelpMessage = "Azure data set name",
120120
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
121121
[ValidateNotNullOrEmpty]
122-
[ResourceNameCompleter(ResourceTypes.DataSet, "ResourceGroupName", "AccountName", "ShareName")]
123122
public string Name { get; set; }
124123

125124
/// <summary>
@@ -141,6 +140,7 @@ public class NewAzDataShareDataSet : AzureDataShareCmdletBase
141140
HelpMessage = "Azure storage account resourceId",
142141
ParameterSetName = ParameterSetNames.AdlsGen1DataSetParameterSet)]
143142
[ValidateNotNullOrEmpty]
143+
[ResourceNameCompleter(ResourceTypes.StorageAccount, "ResourceGroupName")]
144144
public string StorageAccountResourceId { get; set; }
145145

146146
/// <summary>
@@ -229,7 +229,7 @@ public override void ExecuteCmdlet()
229229
ParameterSetNames.BlobDataSetParameterSet,
230230
StringComparison.OrdinalIgnoreCase))
231231
{
232-
if (this.ShouldProcess(this.Name, "Create"))
232+
if (this.ShouldProcess(this.Name, "Creating data set"))
233233
{
234234
if (this.FilePath != null)
235235
{
@@ -297,7 +297,7 @@ public override void ExecuteCmdlet()
297297
StringComparison.OrdinalIgnoreCase))
298298
{
299299

300-
if (this.ShouldProcess(this.Name, "Create"))
300+
if (this.ShouldProcess(this.Name, "Creating data set"))
301301
{
302302
if (this.FilePath != null)
303303
{
@@ -365,7 +365,7 @@ public override void ExecuteCmdlet()
365365
StringComparison.OrdinalIgnoreCase))
366366
{
367367
storageAccountName = parsedStorageResourceId.GetAccountName();
368-
if (this.ShouldProcess(this.Name, "Create"))
368+
if (this.ShouldProcess(this.Name, "Creating data set"))
369369
{
370370
if (this.FileName != null)
371371
{

src/DataShare/DataShare/DataSetMapping/NewAzDataShareDataSetMapping.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public class NewAzDataShareDataSetMapping : AzureDataShareCmdletBase
9999
HelpMessage = "Azure data set mapping name",
100100
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
101101
[ValidateNotNullOrEmpty]
102-
[ResourceNameCompleter(ResourceTypes.DataSetMapping, "ResourceGroupName", "AccountName", "ShareSubscriptionName")]
103102
public string Name { get; set; }
104103

105104
/// <summary>
@@ -116,6 +115,7 @@ public class NewAzDataShareDataSetMapping : AzureDataShareCmdletBase
116115
HelpMessage = "Azure Storage Account ResourceId",
117116
ParameterSetName = ParameterSetNames.AdlsGen2DataSetParameterSet)]
118117
[ValidateNotNullOrEmpty]
118+
[ResourceNameCompleter(ResourceTypes.StorageAccount, "ResourceGroupName")]
119119
public string StorageAccountResourceId { get; set; }
120120

121121
/// <summary>
@@ -198,7 +198,7 @@ public override void ExecuteCmdlet()
198198
ParameterSetNames.BlobDataSetParameterSet,
199199
StringComparison.OrdinalIgnoreCase))
200200
{
201-
if (this.ShouldProcess(this.Name, "Create"))
201+
if (this.ShouldProcess(this.Name, "Creating data set mapping"))
202202
{
203203
if (this.FilePath != null)
204204
{
@@ -269,7 +269,7 @@ public override void ExecuteCmdlet()
269269
StringComparison.OrdinalIgnoreCase))
270270
{
271271

272-
if (this.ShouldProcess(this.Name, "Create"))
272+
if (this.ShouldProcess(this.Name, "Creating data set mapping"))
273273
{
274274
if (this.FilePath != null)
275275
{

src/DataShare/DataShare/DataShare.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,4 @@
2525
</EmbeddedResource>
2626
</ItemGroup>
2727

28-
<ItemGroup>
29-
<PackageReference Update="Microsoft.Rest.ClientRuntime" Version="2.3.20" />
30-
</ItemGroup>
31-
3228
</Project>

src/DataShare/DataShare/Extensions/ResourceTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ public static class ResourceTypes
1010
public const string ShareSubscription = "Microsoft.DataShare/sharesubscriptions";
1111
public const string SynchronizationSetting = "Microsoft.DataShare/synchronizationSettings";
1212
public const string Trigger = "Microsoft.DataShare/triggers";
13+
public const string StorageAccount = "Microsoft.Storage/storageAccounts";
1314
}
1415
}

src/DataShare/DataShare/Invitation/GetAzDataShareInvitation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public class GetAzDataShareInvitation : AzureDataShareCmdletBase
8383
HelpMessage = "Azure data share invitation name",
8484
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
8585
[ValidateNotNullOrEmpty]
86+
[ResourceNameCompleter(ResourceTypes.Invitation, "ResourceGroupName", "AccountName","ShareName")]
8687
public string Name { get; set; }
8788

8889
/// <summary>

src/DataShare/DataShare/Invitation/NewAzDataShareInvitation.cs

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -127,55 +127,39 @@ public override void ExecuteCmdlet()
127127
{
128128
if (this.ParameterSetName.Equals(ParameterSetNames.InvitationEmailParameterSet, StringComparison.OrdinalIgnoreCase))
129129
{
130-
this.ConfirmAction(
131-
string.Format(Resources.ResourceCreateConfirmation, this.Name),
132-
this.Name,
133-
this.NewEmailInvitation);
134-
}
135-
136-
if (this.ParameterSetName.Equals(ParameterSetNames.InvitationTenantParameterSet, StringComparison.OrdinalIgnoreCase))
137-
{
138-
this.ConfirmAction(
139-
string.Format(Resources.ResourceCreateConfirmation, this.Name),
140-
this.Name,
141-
this.NewObjectIdInvitation);
142-
}
143-
}
130+
if (this.ShouldProcess(this.Name, "Creating invitation"))
131+
{
132+
Invitation newInvitation = this.DataShareManagementClient.Invitations.Create(
133+
this.ResourceGroupName,
134+
this.AccountName,
135+
this.ShareName,
136+
this.Name,
137+
new Invitation()
138+
{
139+
TargetEmail = this.TargetEmail
140+
});
144141

145-
private void NewEmailInvitation()
146-
{
147-
if (this.ShouldProcess(this.Name, "Create"))
148-
{
149-
Invitation newInvitation = this.DataShareManagementClient.Invitations.Create(
150-
this.ResourceGroupName,
151-
this.AccountName,
152-
this.ShareName,
153-
this.Name,
154-
new Invitation()
155-
{
156-
TargetEmail = this.TargetEmail
157-
});
158-
159-
this.WriteObject(newInvitation.ToPsObject());
142+
this.WriteObject(newInvitation.ToPsObject());
143+
}
160144
}
161-
}
162145

163-
private void NewObjectIdInvitation()
164-
{
165-
if (this.ShouldProcess(this.Name, "Create"))
146+
if (this.ParameterSetName.Equals(ParameterSetNames.InvitationTenantParameterSet, StringComparison.OrdinalIgnoreCase))
166147
{
167-
Invitation newInvitation = this.DataShareManagementClient.Invitations.Create(
168-
this.ResourceGroupName,
169-
this.AccountName,
170-
this.ShareName,
171-
this.Name,
172-
new Invitation()
173-
{
174-
TargetObjectId = this.TargetObjectId,
175-
TargetActiveDirectoryId = this.TargetTenantId
176-
});
148+
if (this.ShouldProcess(this.Name, "Creating invitation"))
149+
{
150+
Invitation newInvitation = this.DataShareManagementClient.Invitations.Create(
151+
this.ResourceGroupName,
152+
this.AccountName,
153+
this.ShareName,
154+
this.Name,
155+
new Invitation()
156+
{
157+
TargetObjectId = this.TargetObjectId,
158+
TargetActiveDirectoryId = this.TargetTenantId
159+
});
177160

178-
this.WriteObject(newInvitation.ToPsObject());
161+
this.WriteObject(newInvitation.ToPsObject());
162+
}
179163
}
180164
}
181165
}

src/DataShare/DataShare/Invitation/RemoveAzDataShareInvitation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public class RemoveAzDataShareInvitation : AzureDataShareCmdletBase
8080
ValueFromPipelineByPropertyName = true,
8181
ParameterSetName = ParameterSetNames.FieldsParameterSet,
8282
HelpMessage = "Azure data share invitation name")]
83+
[ResourceNameCompleter(ResourceTypes.Invitation, "ResourceGroupName", "AccountName", "ShareName")]
8384
public string Name { get; set; }
8485

8586

src/DataShare/DataShare/ParameterSetNames.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ class ParameterSetNames
1010
public const string BlobDataSetParameterSet = "ByBlobDataSetParamaterSet";
1111
public const string AdlsGen2DataSetParameterSet = "ByAdlsGen2DataSetParameterSet";
1212
public const string AdlsGen1DataSetParameterSet = "ByAdlsGen1DataSetParameterSet";
13+
public const string ProviderShareSubscriptionIdParameterSet = "ByProviderShareSubscriptionIdParameterSet";
1314
}
1415
}

src/DataShare/DataShare/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
[assembly: ComVisible(false)]
2626
[assembly: CLSCompliant(false)]
2727
[assembly: Guid("d90791a2-8102-47fc-8150-de25ae796eb1")]
28-
[assembly: AssemblyVersion("1.1.0")]
29-
[assembly: AssemblyFileVersion("1.1.0")]
28+
[assembly: AssemblyVersion("0.1.0")]
29+
[assembly: AssemblyFileVersion("0.1.0")]

src/DataShare/DataShare/ProviderShareSubscriptions/GrantAzDataShareSubscriptionAccess.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ public class GrantAzDataShareSubscriptionAccess : AzureDataShareCmdletBase
8080
Mandatory = true,
8181
ValueFromPipelineByPropertyName = true,
8282
HelpMessage = "The share subscription id of the provider share subscription",
83-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
84-
[ResourceIdCompleter(ResourceTypes.ShareSubscription)]
83+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
8584
[ValidateNotNullOrEmpty]
8685
public string ShareSubscriptionId { get; set; }
8786

@@ -92,7 +91,7 @@ public class GrantAzDataShareSubscriptionAccess : AzureDataShareCmdletBase
9291
Mandatory = true,
9392
ValueFromPipelineByPropertyName = true,
9493
HelpMessage = "The resource id of the azure data share",
95-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
94+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
9695
[ResourceIdCompleter(ResourceTypes.Share)]
9796
[ValidateNotNullOrEmpty]
9897
public string ResourceId { get; set; }

src/DataShare/DataShare/ProviderShareSubscriptions/RevokeAzDataShareSubscriptionAccess.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public class RevokeAzDataShareSubscriptionAccess : AzureDataShareCmdletBase
8181
Mandatory = true,
8282
ValueFromPipelineByPropertyName = true,
8383
HelpMessage = "The share subscription id of the provider share subscription",
84-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
84+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
8585
[ValidateNotNullOrEmpty]
8686
public string ShareSubscriptionId { get; set; }
8787

@@ -92,7 +92,7 @@ public class RevokeAzDataShareSubscriptionAccess : AzureDataShareCmdletBase
9292
Mandatory = true,
9393
ValueFromPipelineByPropertyName = true,
9494
HelpMessage = "The resource id of the azure data share",
95-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
95+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
9696
[ResourceIdCompleter(ResourceTypes.Share)]
9797
[ValidateNotNullOrEmpty]
9898
public string ResourceId { get; set; }

src/DataShare/DataShare/Share/GetAzDataShareProviderShareSubscription.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class GetAzDataShareProviderShareSubscription : AzureDataShareCmdletBase
8686
Mandatory = false,
8787
ValueFromPipelineByPropertyName = true,
8888
HelpMessage = "The share subscription id of the provider share subscription",
89-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
89+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
9090
[ValidateNotNullOrEmpty]
9191
public string ShareSubscriptionId { get; set; }
9292

@@ -97,7 +97,7 @@ public class GetAzDataShareProviderShareSubscription : AzureDataShareCmdletBase
9797
Mandatory = true,
9898
ValueFromPipelineByPropertyName = true,
9999
HelpMessage = "The resource id of the share",
100-
ParameterSetName = ParameterSetNames.ResourceIdParameterSet)]
100+
ParameterSetName = ParameterSetNames.ProviderShareSubscriptionIdParameterSet)]
101101
[ResourceIdCompleter(ResourceTypes.Share)]
102102
[ValidateNotNullOrEmpty]
103103
public string ResourceId { get; set; }

src/DataShare/DataShare/Share/NewAzDataShare.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class NewAzDataShare : AzureDataShareCmdletBase
6060
ParameterSetName = ParameterSetNames.FieldsParameterSet,
6161
HelpMessage = "Azure data share name")]
6262
[ValidateNotNullOrEmpty]
63-
[ResourceNameCompleter(ResourceTypes.Share, "ResourceGroupName", "AccountName")]
6463
public string Name { get; set; }
6564

6665
/// <summary>
@@ -83,15 +82,7 @@ public class NewAzDataShare : AzureDataShareCmdletBase
8382

8483
public override void ExecuteCmdlet()
8584
{
86-
this.ConfirmAction(
87-
string.Format(Resources.ResourceCreateConfirmation, this.Name),
88-
this.Name,
89-
this.NewShare);
90-
}
91-
92-
private void NewShare()
93-
{
94-
if (this.ShouldProcess(this.Name, "Create"))
85+
if (this.ShouldProcess(this.Name, "Creating data share"))
9586
{
9687
Share dataShare = this.DataShareManagementClient.Shares.Create(
9788
this.ResourceGroupName,

src/DataShare/DataShare/ShareSubscription/NewAzDataShareSubscription.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public class NewAzDataShareSubscription : AzureDataShareCmdletBase
6060
ParameterSetName = ParameterSetNames.FieldsParameterSet,
6161
HelpMessage = "Azure data share subscription name")]
6262
[ValidateNotNullOrEmpty]
63-
[ResourceNameCompleter(ResourceTypes.ShareSubscription, "ResourceGroupName", "AccountName")]
6463
public string Name { get; set; }
6564

6665
/// <summary>
@@ -75,15 +74,7 @@ public class NewAzDataShareSubscription : AzureDataShareCmdletBase
7574

7675
public override void ExecuteCmdlet()
7776
{
78-
this.ConfirmAction(
79-
string.Format(Resources.ResourceCreateConfirmation, this.Name),
80-
this.Name,
81-
this.NewShareSubscription);
82-
}
83-
84-
private void NewShareSubscription()
85-
{
86-
if (this.ShouldProcess(this.Name, "Create"))
77+
if (this.ShouldProcess(this.Name, "Creating share subscription"))
8778
{
8879
ShareSubscription shareSubscription = this.DataShareManagementClient.ShareSubscriptions.Create(
8980
this.ResourceGroupName,

src/DataShare/DataShare/SynchronizationSettings/NewAzDataShareSynchronizationSetting.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ public class NewAzDataShareSynchronizationSetting : AzureDataShareCmdletBase
8181
HelpMessage = "Synchronization setting name",
8282
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
8383
[ValidateNotNullOrEmpty]
84-
[ResourceNameCompleter(ResourceTypes.SynchronizationSetting, "ResourceGroupName", "AccountName", "ShareName")]
8584
public string Name { get; set; }
8685

8786
/// <summary>
@@ -109,7 +108,7 @@ public class NewAzDataShareSynchronizationSetting : AzureDataShareCmdletBase
109108

110109
public override void ExecuteCmdlet()
111110
{
112-
if (this.ShouldProcess(this.Name, "Create"))
111+
if (this.ShouldProcess(this.Name, "Creating share synchronization"))
113112
{
114113
var setting = new ScheduledSynchronizationSetting(
115114
recurrenceInterval: this.RecurrenceInterval,

src/DataShare/DataShare/Trigger/NewAzDataShareTrigger.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public class NewAzDataShareTrigger : AzureDataShareCmdletBase
7676
HelpMessage = "Azure data share trigger name",
7777
ParameterSetName = ParameterSetNames.FieldsParameterSet)]
7878
[ValidateNotNullOrEmpty]
79-
[ResourceNameCompleter(ResourceTypes.Trigger, "ResourceGroupName", "AccountName", "ShareSubscriptionName")]
8079
public string Name { get; set; }
8180

8281

0 commit comments

Comments
 (0)