Skip to content

Commit 232be6f

Browse files
author
begoldsm
committed
Add warning for disabled IDP and firewall states
Add warning to deletes. Fix from using private package Was using private package previously that hadn't fully refactored Upload -> Transfer Missed removal of Uploader package in tests. Fix the wxi file.
1 parent 1d22a14 commit 232be6f

13 files changed

+58
-22
lines changed

setup/azurecmdfiles.wxi

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,6 @@
981981
<Component Id="cmp3C96010EFA751762A76B66B811613835" Guid="*">
982982
<File Id="fil509D1E7494560B2BB3462B8FAD7954CF" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Management.DataLake.Store.dll" />
983983
</Component>
984-
<Component Id="cmpFECE1A517C9182672B042869C46847FC" Guid="*">
985-
<File Id="fil00C18C352C99B9BCFA42EFFACE0AEFF7" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Management.DataLake.StoreUploader.dll" />
986-
</Component>
987984
<Component Id="cmp500DAF931B66664E6A3308FAC825093C" Guid="*">
988985
<File Id="filB384FAE2600A5CAE72336384DBA3B581" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Management.ResourceManager.dll" />
989986
</Component>
@@ -6038,7 +6035,6 @@
60386035
<ComponentRef Id="cmp87FB43928F7A2ECF62C0141446D21A9F" />
60396036
<ComponentRef Id="cmpD2292657EF3D9CEAC5D4FA7DEB3E7E8E" />
60406037
<ComponentRef Id="cmp3C96010EFA751762A76B66B811613835" />
6041-
<ComponentRef Id="cmpFECE1A517C9182672B042869C46847FC" />
60426038
<ComponentRef Id="cmp500DAF931B66664E6A3308FAC825093C" />
60436039
<ComponentRef Id="cmpFCFE1AC675F0BA7336B392A419D70042" />
60446040
<ComponentRef Id="cmpB41201E194E7639BC9C33ADECC894426" />

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/Commands.DataLakeStore.Test.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@
6767
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.Store.2.0.0-preview\lib\net45\Microsoft.Azure.Management.DataLake.Store.dll</HintPath>
6868
<Private>True</Private>
6969
</Reference>
70-
<Reference Include="Microsoft.Azure.Management.DataLake.StoreUploader">
71-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.DataLake.StoreUploader.1.0.1-preview\lib\net45\Microsoft.Azure.Management.DataLake.StoreUploader.dll</HintPath>
72-
<Private>True</Private>
73-
</Reference>
7470
<Reference Include="Microsoft.Azure.Management.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7571
<SpecificVersion>False</SpecificVersion>
7672
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.1.1-preview\lib\net45\Microsoft.Azure.Management.ResourceManager.dll</HintPath>

src/ResourceManager/DataLakeStore/Commands.DataLakeStore.Test/packages.config

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
77
<package id="Microsoft.Azure.Management.Authorization" version="2.0.0" targetFramework="net45" />
88
<package id="Microsoft.Azure.Management.DataLake.Store" version="2.0.0-preview" targetFramework="net45" />
9-
<package id="Microsoft.Azure.Management.DataLake.StoreUploader" version="1.0.1-preview" targetFramework="net45" />
109
<package id="Microsoft.Azure.Management.ResourceManager" version="1.1.1-preview" targetFramework="net45" />
1110
<package id="Microsoft.Azure.Management.Resources" version="2.20.0-preview" targetFramework="net45" />
1211
<package id="Microsoft.Azure.Test.Framework" version="1.0.6179.26854-prerelease" targetFramework="net45" />

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/AddAzureRmDataLakeStoreFirewallRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public override void ExecuteCmdlet()
5959
Name,
6060
() =>
6161
WriteObject(new DataLakeStoreFirewallRule(DataLakeStoreClient.AddOrUpdateFirewallRule(
62-
ResourceGroupName, Account, Name, StartIpAddress, EndIpAddress)))
62+
ResourceGroupName, Account, Name, StartIpAddress, EndIpAddress, this)))
6363
);
6464
}
6565
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/AddAzureRmDataLakeStoreTrustedIdProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override void ExecuteCmdlet()
5454
Name,
5555
() =>
5656
WriteObject(new DataLakeStoreTrustedIdProvider(DataLakeStoreClient.AddOrUpdateTrustedProvider(
57-
ResourceGroupName, Account, Name, ProviderEndpoint)))
57+
ResourceGroupName, Account, Name, ProviderEndpoint, this)))
5858
);
5959
}
6060
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/RemoveAzureRmDataLakeStoreFirewallRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override void ExecuteCmdlet()
5656
Name,
5757
() =>
5858
{
59-
DataLakeStoreClient.DeleteFirewallRule(ResourceGroupName, Account, Name);
59+
DataLakeStoreClient.DeleteFirewallRule(ResourceGroupName, Account, Name, this);
6060
if (PassThru)
6161
{
6262
WriteObject(true);

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/RemoveAzureRmDataLakeStoreTrustedIdProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override void ExecuteCmdlet()
5656
Name,
5757
() =>
5858
{
59-
DataLakeStoreClient.DeleteTrustedProvider(ResourceGroupName, Account, Name);
59+
DataLakeStoreClient.DeleteTrustedProvider(ResourceGroupName, Account, Name, this);
6060
if (PassThru)
6161
{
6262
WriteObject(true);

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/SetAzureRmDataLakeStoreFirewallRule.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public override void ExecuteCmdlet()
6868
Name,
6969
() =>
7070
WriteObject(new DataLakeStoreFirewallRule(DataLakeStoreClient.AddOrUpdateFirewallRule(
71-
ResourceGroupName, Account, Name, startIp, endIp)))
71+
ResourceGroupName, Account, Name, startIp, endIp, this)))
7272
);
7373
}
7474
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Commands/SetAzureRmDataLakeStoreTrustedIdProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override void ExecuteCmdlet()
5454
Name,
5555
() =>
5656
WriteObject(new DataLakeStoreTrustedIdProvider(DataLakeStoreClient.AddOrUpdateTrustedProvider(
57-
ResourceGroupName, Account, Name, ProviderEndpoint)))
57+
ResourceGroupName, Account, Name, ProviderEndpoint, this)))
5858
);
5959
}
6060
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreClient.cs

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
using System;
2323
using System.Collections;
2424
using System.Collections.Generic;
25+
using System.Management.Automation;
2526
using System.Net;
2627

2728
namespace Microsoft.Azure.Commands.DataLakeStore.Models
@@ -189,13 +190,18 @@ public DataLakeStoreAccount GetAccount(string resourceGroupName, string accountN
189190

190191
return _client.Account.Get(resourceGroupName, accountName);
191192
}
192-
public FirewallRule AddOrUpdateFirewallRule(string resourceGroupName, string accountName, string ruleName, string startIp, string endIp)
193+
public FirewallRule AddOrUpdateFirewallRule(string resourceGroupName, string accountName, string ruleName, string startIp, string endIp, Cmdlet runningCommand)
193194
{
194195
if (string.IsNullOrEmpty(resourceGroupName))
195196
{
196197
resourceGroupName = GetResourceGroupByAccount(accountName);
197198
}
198199

200+
if (_client.Account.Get(resourceGroupName, accountName).FirewallState == FirewallState.Disabled)
201+
{
202+
runningCommand.WriteWarning(string.Format(Properties.Resources.FirewallDisabledWarning, accountName));
203+
}
204+
199205
return _client.FirewallRules.CreateOrUpdate(
200206
resourceGroupName,
201207
accountName,
@@ -208,13 +214,18 @@ public FirewallRule AddOrUpdateFirewallRule(string resourceGroupName, string acc
208214
});
209215
}
210216

211-
public void DeleteFirewallRule(string resourceGroupName, string accountName, string ruleName)
217+
public void DeleteFirewallRule(string resourceGroupName, string accountName, string ruleName, Cmdlet runningCommand)
212218
{
213219
if (string.IsNullOrEmpty(resourceGroupName))
214220
{
215221
resourceGroupName = GetResourceGroupByAccount(accountName);
216222
}
217223

224+
if (_client.Account.Get(resourceGroupName, accountName).FirewallState == FirewallState.Disabled)
225+
{
226+
runningCommand.WriteWarning(string.Format(Properties.Resources.FirewallDisabledWarning, accountName));
227+
}
228+
218229
_client.FirewallRules.Delete(resourceGroupName, accountName, ruleName);
219230
}
220231

@@ -228,13 +239,18 @@ public FirewallRule GetFirewallRule(string resourceGroupName, string accountName
228239
return _client.FirewallRules.Get(resourceGroupName, accountName, ruleName);
229240
}
230241

231-
public TrustedIdProvider AddOrUpdateTrustedProvider(string resourceGroupName, string accountName, string providerName, string providerEndpoint)
242+
public TrustedIdProvider AddOrUpdateTrustedProvider(string resourceGroupName, string accountName, string providerName, string providerEndpoint, Cmdlet runningCommand)
232243
{
233244
if (string.IsNullOrEmpty(resourceGroupName))
234245
{
235246
resourceGroupName = GetResourceGroupByAccount(accountName);
236247
}
237248

249+
if (_client.Account.Get(resourceGroupName, accountName).TrustedIdProviderState == TrustedIdProviderState.Disabled)
250+
{
251+
runningCommand.WriteWarning(string.Format(Properties.Resources.TrustedIdProviderDisabledWarning, accountName));
252+
}
253+
238254
return _client.TrustedIdProviders.CreateOrUpdate(
239255
resourceGroupName,
240256
accountName,
@@ -245,13 +261,18 @@ public TrustedIdProvider AddOrUpdateTrustedProvider(string resourceGroupName, st
245261
});
246262
}
247263

248-
public void DeleteTrustedProvider(string resourceGroupName, string accountName, string providerName)
264+
public void DeleteTrustedProvider(string resourceGroupName, string accountName, string providerName, Cmdlet runningCommand)
249265
{
250266
if (string.IsNullOrEmpty(resourceGroupName))
251267
{
252268
resourceGroupName = GetResourceGroupByAccount(accountName);
253269
}
254270

271+
if (_client.Account.Get(resourceGroupName, accountName).TrustedIdProviderState == TrustedIdProviderState.Disabled)
272+
{
273+
runningCommand.WriteWarning(string.Format(Properties.Resources.TrustedIdProviderDisabledWarning, accountName));
274+
}
275+
255276
_client.TrustedIdProviders.Delete(resourceGroupName, accountName, providerName);
256277
}
257278

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/Models/DataLakeStoreFileSystemClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public void CopyFile(string destinationPath, string accountName, string sourcePa
365365
{
366366
lock (ConsoleOutputLock)
367367
{
368-
var toSet = (int)(1.0 * e.UploadedByteCount / e.TotalFileLength * 100);
368+
var toSet = (int)(1.0 * e.TransferredByteCount / e.TotalFileLength * 100);
369369
// powershell defect protection. If, through some defect in
370370
// our progress tracking, the number is outside of 0 - 100,
371371
// powershell will crash if it is set to that value. Instead
@@ -486,7 +486,7 @@ public void CopyDirectory(
486486
{
487487
lock (ConsoleOutputLock)
488488
{
489-
var toSet = (int)(1.0 * e.UploadedByteCount / e.TotalFileLength * 100);
489+
var toSet = (int)(1.0 * e.TransferredByteCount / e.TotalFileLength * 100);
490490
// powershell defect protection. If, through some defect in
491491
// our progress tracking, the number is outside of 0 - 100,
492492
// powershell will crash if it is set to that value. Instead
@@ -500,7 +500,7 @@ public void CopyDirectory(
500500
progress.PercentComplete = toSet;
501501
}
502502
progress.Activity = string.Format("Copying Folder: {0}{1}. Total bytes remaining: {2}. Total files remaining: {3}",
503-
sourceFolderPath, recursive ? " recursively" : string.Empty, e.TotalFileLength - e.UploadedByteCount, e.TotalFileCount - e.UploadedFileCount);
503+
sourceFolderPath, recursive ? " recursively" : string.Empty, e.TotalFileLength - e.TransferredByteCount, e.TotalFileCount - e.TransferredFileCount);
504504
}
505505
};
506506

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/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/ResourceManager/DataLakeStore/Commands.DataLakeStore/Properties/Resources.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150
<data name="FilePreviewTooLarge" xml:space="preserve">
151151
<value>The remaining data to preview is greater than {0} bytes. Please specify a length or use the Force parameter to preview the entire file. The length of the file that would have been previewed: {1}</value>
152152
</data>
153+
<data name="FirewallDisabledWarning" xml:space="preserve">
154+
<value>The firewall is currently disabled for account: {0}. Updates to firewall rules will not take affect until the firewall is enabled.</value>
155+
</data>
153156
<data name="FirewallRuleNotFound" xml:space="preserve">
154157
<value>The specified firewall rule '{0}' does not exist.</value>
155158
</data>
@@ -286,6 +289,9 @@
286289
<data name="TraceStreamFailure" xml:space="preserve">
287290
<value>Error creating FileStream for diagnostic trace file \"{0}\" - No diagnostics will be captured. Failed with Error:\r\n{1}</value>
288291
</data>
292+
<data name="TrustedIdProviderDisabledWarning" xml:space="preserve">
293+
<value>The trusted identity provider is currently disabled for account: {0}. Updates to trusted identity providers will not take affect until the trusted identity provider is enabled.</value>
294+
</data>
289295
<data name="UploadFailedMessage" xml:space="preserve">
290296
<value>Upload operation failed due to the following underlying error: {0}. You can try to resume the upload by specifying the "Resume" option. If the error persists, please contact Microsoft support.</value>
291297
</data>

0 commit comments

Comments
 (0)