Skip to content

Commit 1b72d24

Browse files
committed
Add build exceptions, Remove nullable type from parameter, MAke a parameter mandatory in SetExpiry
1 parent eecb58f commit 1b72d24

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneCommands/SetAzureRmDataLakeStoreItemExpiry.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ public class SetAzureRmDataLakeStoreItemExpiry : DataLakeStoreFileSystemCmdletBa
4545
HelpMessage =
4646
"The expiration time for the specified file. If no value or set to MaxValue, the file will never expire.")]
4747
[ValidateNotNullOrEmpty]
48-
public DateTimeOffset? Expiration { get; set; }
48+
public DateTimeOffset Expiration { get; set; }
4949

50-
[Parameter(ValueFromPipelineByPropertyName = true, Position = 2,ParameterSetName = RelativeExpiryParameterSetName, Mandatory = false,
50+
[Parameter(ValueFromPipelineByPropertyName = true, Position = 2,ParameterSetName = RelativeExpiryParameterSetName, Mandatory = true,
5151
HelpMessage = "Relative expiry options. RelativeToNow or RelativeToCreationDate are current options")]
5252
[ValidateNotNullOrEmpty]
53-
public DataLakeStoreEnums.PathRelativeExpiryOptions? RelativeFileExpiryOption { get; set; }
53+
public DataLakeStoreEnums.PathRelativeExpiryOptions RelativeFileExpiryOption { get; set; }
5454

5555
[Parameter(ValueFromPipelineByPropertyName = true, Position = 3, ParameterSetName = RelativeExpiryParameterSetName, Mandatory = false,
56-
HelpMessage = "The relative time in milliseconds with respect to now or creation time")]
56+
HelpMessage = "The relative time in milliseconds with respect to now or creation time. By default it will be zero.")]
5757
[ValidateNotNullOrEmpty]
58-
public long? RelativeTime { get; set; }
58+
public long RelativeTime { get; set; }
5959

6060
public override void ExecuteCmdlet()
6161
{
@@ -72,21 +72,21 @@ public override void ExecuteCmdlet()
7272
? ExpiryOption.RelativeToCreationDate
7373
: ExpiryOption
7474
.RelativeToNow;
75-
tickValue = RelativeTime.Value;
75+
tickValue = RelativeTime;
7676
}
7777
else
7878
{
79-
if (!Expiration.HasValue)
79+
if (!MyInvocation.BoundParameters.ContainsKey(nameof(Expiration)))
8080
{
8181
Expiration = DateTimeOffset.MaxValue;
8282
}
83-
tickValue = DataLakeStoreFileSystemClient.ToUnixTimeStampMs(Expiration.GetValueOrDefault());
83+
tickValue = DataLakeStoreFileSystemClient.ToUnixTimeStampMs(Expiration);
8484
}
8585
ConfirmAction(
86-
string.Format(Resources.SetFileExpiry, Path.OriginalPath, Expiration.GetValueOrDefault()),
86+
string.Format(Resources.SetFileExpiry, Path.OriginalPath, ParameterSetName.Equals(RelativeExpiryParameterSetName) ? $"{exop} {RelativeTime}" : Expiration.ToString()),
8787
Path.OriginalPath,
8888
() =>
89-
WriteObject(new DataLakeStoreItem(DataLakeStoreFileSystemClient.SetExpiry(Path.TransformedPath, Account, tickValue,exop)))
89+
WriteObject(new DataLakeStoreItem(DataLakeStoreFileSystemClient.SetExpiry(Path.TransformedPath, Account, tickValue, exop)))
9090
);
9191
}
9292
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/DataPlaneModels/AdlsClientFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Text.RegularExpressions;
66
using Microsoft.Azure.DataLake.Store.MockAdlsFileSystem;
77
using Microsoft.Rest;
8+
using Microsoft.WindowsAzure.Commands.Common;
89

910
namespace Microsoft.Azure.Commands.DataLakeStore.Models
1011
{
@@ -55,6 +56,7 @@ internal static AdlsClient GetAdlsClient(string accntNm, IAzureContext context)
5556
AzureEnvironment.Endpoint.AzureDataLakeStoreFileSystemEndpointSuffix);
5657
}
5758
var client=AdlsClient.CreateClient(accntNm,creds);
59+
client.AddUserAgentSuffix(AzurePowerShell.UserAgentValue.ToString());
5860
ClientFactory.Add(accntNm,client);
5961
return client;
6062
}

src/ResourceManager/DataLakeStore/Commands.DataLakeStore/help/Set-AzureRmDataLakeStoreItemExpiry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Parameter Sets: Set expiry as relative to creation or now
114114
Aliases:
115115
Accepted values: RelativeToNow, RelativeToCreationDate
116116

117-
Required: False
117+
Required: True
118118
Position: 2
119119
Default value: None
120120
Accept pipeline input: True (ByPropertyName)

tools/StaticAnalysis/Exceptions/BreakingChangeIssues.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,9 @@
766766
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Sql\Microsoft.Azure.Commands.Sql.dll","Microsoft.Azure.Commands.Sql.Database.Cmdlet.SetAzureSqlDatabase","Set-AzureRmSqlDatabase","0","2100","The parameter 'ElasticPoolName' in cmdlet 'Set-AzureRmSqlDatabase' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'ElasticPoolName' back to the parameter set '__AllParameterSets'."
767767
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Sql\Microsoft.Azure.Commands.Sql.dll","Microsoft.Azure.Commands.Sql.Database.Cmdlet.SetAzureSqlDatabase","Set-AzureRmSqlDatabase","0","2100","The parameter 'ReadScale' in cmdlet 'Set-AzureRmSqlDatabase' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'ReadScale' back to the parameter set '__AllParameterSets'."
768768
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.Sql\Microsoft.Azure.Commands.Sql.dll","Microsoft.Azure.Commands.Sql.Database.Cmdlet.SetAzureSqlDatabase","Set-AzureRmSqlDatabase","0","2100","The parameter 'Tags' in cmdlet 'Set-AzureRmSqlDatabase' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Tags' back to the parameter set '__AllParameterSets'."
769-
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.SetAzureRmDataLakeStoreItemExpiry","Set-AzureRmDataLakeStoreItemExpiry","0","3000","The type of property 'Type' of type 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreItem' has changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType'.","Change the type of property 'Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."
770769
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.SetAzureRmDataLakeStoreItemExpiry","Set-AzureRmDataLakeStoreItemExpiry","0","2100","The parameter 'Account' in cmdlet 'Set-AzureRmDataLakeStoreItemExpiry' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Account' back to the parameter set '__AllParameterSets'."
771770
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.SetAzureRmDataLakeStoreItemExpiry","Set-AzureRmDataLakeStoreItemExpiry","0","2100","The parameter 'Path' in cmdlet 'Set-AzureRmDataLakeStoreItemExpiry' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Path' back to the parameter set '__AllParameterSets'."
772771
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.SetAzureRmDataLakeStoreItemExpiry","Set-AzureRmDataLakeStoreItemExpiry","0","2100","The parameter 'Expiration' in cmdlet 'Set-AzureRmDataLakeStoreItemExpiry' is no longer in the parameter set '__AllParameterSets'.","Add parameter 'Expiration' back to the parameter set '__AllParameterSets'."
773-
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem","Get-AzureRmDataLakeStoreChildItem","0","3000","The type of property 'Type' of type 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreItem' has changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType'.","Change the type of property 'Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."
774-
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreItem","Get-AzureRmDataLakeStoreItem","0","3000","The type of property 'Type' of type 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreItem' has changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType'.","Change the type of property 'Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."
772+
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.SetAzureRmDataLakeStoreItemExpiry","Set-AzureRmDataLakeStoreItemExpiry","0","3030","The generic type for 'property Type' has been changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'System.Nullable`1[Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType]'. ","Change the generic type for 'property Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."
773+
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreChildItem","Get-AzureRmDataLakeStoreChildItem","0","3030","The generic type for 'property Type' has been changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'System.Nullable`1[Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType]'. ","Change the generic type for 'property Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."
774+
"d:\workspace\powershell\src\Package\Debug\ResourceManager\AzureResourceManager\AzureRM.DataLakeStore\Microsoft.Azure.Commands.DataLakeStore.dll","Microsoft.Azure.Commands.DataLakeStore.GetAzureDataLakeStoreItem","Get-AzureRmDataLakeStoreItem","0","3030","The generic type for 'property Type' has been changed from 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]' to 'System.Nullable`1[Microsoft.Azure.Commands.DataLakeStore.Models.DataLakeStoreEnums+FileType]'. ","Change the generic type for 'property Type' back to 'System.Nullable`1[Microsoft.Azure.Management.DataLake.Store.Models.FileType]'."

0 commit comments

Comments
 (0)