Skip to content

Commit a21f588

Browse files
authored
Merge pull request #5 from gaurangisaxena/gasaxena/powershell
use resource strings
2 parents 8468bcd + c8ab647 commit a21f588

19 files changed

+103
-91
lines changed

src/DataShare/DataShare/Account/GetAzDataShareAccount.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.Account
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -134,11 +135,7 @@ public override void ExecuteCmdlet()
134135
}
135136
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
136137
{
137-
throw new PSArgumentException(
138-
string.Format(
139-
"Account not found",
140-
this.Name,
141-
this.ResourceGroupName));
138+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
142139
}
143140
}
144141
}

src/DataShare/DataShare/ConsumerInvitation/GetAzDataShareReceivedInvitation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace Microsoft.Azure.Commands.DataShare.ConsumerInvitation
2525
using Microsoft.Azure.Management.DataShare.Models;
2626
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2727
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
28+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
2829
using Microsoft.Rest.Azure;
2930

3031
/// <summary>
@@ -70,8 +71,7 @@ public override void ExecuteCmdlet()
7071
}
7172
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
7273
{
73-
throw new PSArgumentException(
74-
$"ConsumerInvitation {this.InvitationId} not found");
74+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.InvitationId));
7575
}
7676
}
7777
else

src/DataShare/DataShare/DataSet/GetAzDataShareDataSet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.DataSet
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -117,8 +118,7 @@ public override void ExecuteCmdlet()
117118
}
118119
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
119120
{
120-
throw new PSArgumentException(
121-
$"DataSet {this.Name} not found");
121+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
122122
}
123123
}
124124
else

src/DataShare/DataShare/DataSetMapping/GetAzDataShareDataSetMapping.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.DataSetMapping
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -118,8 +119,7 @@ public override void ExecuteCmdlet()
118119
}
119120
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
120121
{
121-
throw new PSArgumentException(
122-
$"DataSetMapping {this.Name} not found");
122+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
123123
}
124124
}
125125
else

src/DataShare/DataShare/Invitation/GetAzDataShareInvitation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.Invitation
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -119,8 +120,7 @@ public override void ExecuteCmdlet()
119120
}
120121
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
121122
{
122-
throw new PSArgumentException(
123-
$"Invitation {this.Name} not found");
123+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
124124
}
125125
}
126126
else

src/DataShare/DataShare/Properties/Resources.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DataShare/DataShare/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,18 @@
129129
<data name="ResourceCreateMessage" xml:space="preserve">
130130
<value>Creating '{0}'</value>
131131
</data>
132+
<data name="ResourceNotFoundMessage" xml:space="preserve">
133+
<value>Resource '{0}' does not exist</value>
134+
</data>
132135
<data name="ResourceRemovalConfirmation" xml:space="preserve">
133136
<value>Are you sure you want to remove resource '{0}'? </value>
134137
</data>
135138
<data name="ResourceRemovedMessage" xml:space="preserve">
136139
<value>Removing resource '{0}'</value>
137140
</data>
141+
<data name="ResourceUpdataConfirmation" xml:space="preserve">
142+
<value>Are you sure you want to update this resource?</value>
143+
</data>
138144
<data name="RevokeShareSubscriptionAccess" xml:space="preserve">
139145
<value>Revoking access of share subscription</value>
140146
</data>

src/DataShare/DataShare/Share/GetAzDataShare.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.Share
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -106,8 +107,7 @@ public override void ExecuteCmdlet()
106107
}
107108
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
108109
{
109-
throw new PSArgumentException(
110-
$"Share {this.Name} not found");
110+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
111111
}
112112
}
113113
else

src/DataShare/DataShare/Share/GetAzDataShareProviderShareSubscription.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Microsoft.Azure.Commands.DataShare.Share
2727
using Microsoft.Azure.Management.Internal.Resources.Utilities.Models;
2828
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Extensions;
2929
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Models;
30+
using Microsoft.Azure.PowerShell.Cmdlets.DataShare.Properties;
3031
using Microsoft.Rest.Azure;
3132

3233
/// <summary>
@@ -122,8 +123,7 @@ public override void ExecuteCmdlet()
122123
}
123124
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
124125
{
125-
throw new PSArgumentException(
126-
$"ProviderShareSubscription {this.ShareSubscriptionId} not found");
126+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.ShareSubscriptionId));
127127
}
128128
}
129129
else

src/DataShare/DataShare/Share/SetAzDataShare.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,13 @@ public override void ExecuteCmdlet()
143143
}
144144
catch (DataShareErrorException ex) when (ex.Response.StatusCode.Equals(HttpStatusCode.NotFound))
145145
{
146-
throw new PSArgumentException(
147-
string.Format(
148-
$"Share {this.Name} not found"));
146+
throw new PSArgumentException(string.Format(Resources.ResourceNotFoundMessage, this.Name));
149147
}
150148

151149
if (this.Description != null || this.TermsOfUse != null)
152150
{
153151
this.ConfirmAction(
154-
"Update resource",
152+
Resources.ResourceUpdataConfirmation,
155153
this.Name,
156154
() => this.UpdateShare(existingShare));
157155

0 commit comments

Comments
 (0)