@@ -55,7 +55,7 @@ public class GetAzureBackupJob : AzureBackupCmdletBase
55
55
public string Status { get ; set ; }
56
56
57
57
[ Parameter ( Mandatory = false , HelpMessage = AzureBackupCmdletHelpMessage . JobFilterTypeHelpMessage , ParameterSetName = "FiltersSet" ) ]
58
- [ ValidateSet ( "VM " ) ]
58
+ [ ValidateSet ( "IaasVM " ) ]
59
59
public string Type { get ; set ; }
60
60
61
61
[ Parameter ( Mandatory = false , HelpMessage = AzureBackupCmdletHelpMessage . JobFilterOperationHelpMessage , ParameterSetName = "FiltersSet" ) ]
@@ -81,18 +81,22 @@ public override void ExecuteCmdlet()
81
81
// validations
82
82
if ( ! From . HasValue )
83
83
{
84
+ if ( To . HasValue )
85
+ {
86
+ throw new Exception ( "Please specify both From and To." ) ;
87
+ }
84
88
WriteDebug ( "Setting StartTime to min value." ) ;
85
89
From = new DateTime ( ) ;
86
- From = DateTime . MinValue ;
90
+ From = AzureBackupJobHelper . MinimumAllowedDate ;
87
91
}
88
92
89
93
if ( To . HasValue && To . Value <= From . Value )
90
94
{
91
- throw new Exception ( "StartTime should be greater than EndTime ." ) ;
95
+ throw new Exception ( "From should be lesser than To ." ) ;
92
96
}
93
97
else
94
98
{
95
- if ( From != DateTime . MinValue )
99
+ if ( From != AzureBackupJobHelper . MinimumAllowedDate )
96
100
{
97
101
WriteDebug ( "End time not set. Setting it to current time." ) ;
98
102
To = DateTime . Now ;
@@ -101,7 +105,7 @@ public override void ExecuteCmdlet()
101
105
{
102
106
WriteDebug ( "Setting EndTime to min value." ) ;
103
107
To = new DateTime ( ) ;
104
- To = DateTime . MinValue ;
108
+ To = AzureBackupJobHelper . MinimumAllowedDate ;
105
109
}
106
110
}
107
111
@@ -110,7 +114,7 @@ public override void ExecuteCmdlet()
110
114
111
115
// if user hasn't specified any filters, then default filter fetches
112
116
// all jobs that were created in last 24 hours.
113
- if ( From == DateTime . MinValue && To == DateTime . MinValue &&
117
+ if ( From == AzureBackupJobHelper . MinimumAllowedDate && To == AzureBackupJobHelper . MinimumAllowedDate &&
114
118
string . IsNullOrEmpty ( Operation ) && string . IsNullOrEmpty ( Status ) &&
115
119
string . IsNullOrEmpty ( Type ) && string . IsNullOrEmpty ( JobId ) )
116
120
{
0 commit comments