@@ -41,13 +41,24 @@ namespace Microsoft.Azure.Commands.RecoveryServices.Backup.Cmdlets
41
41
/// </summary>
42
42
public abstract class RecoveryServicesBackupCmdletBase : AzureRMCmdlet
43
43
{
44
- // in seconds
44
+ /// <summary>
45
+ /// Defines the time (in seconds) to sleep in between calls while tracking operations
46
+ /// </summary>
45
47
private int _defaultSleepForOperationTracking = 5 ;
46
48
49
+ /// <summary>
50
+ /// Service client adapter is used to make calls to the backend service
51
+ /// </summary>
47
52
protected ServiceClientAdapter ServiceClientAdapter { get ; set ; }
48
53
54
+ /// <summary>
55
+ /// Resource management client is used to make calls to the Compute service
56
+ /// </summary>
49
57
protected ResourcesNS . ResourceManagementClient RmClient { get ; set ; }
50
58
59
+ /// <summary>
60
+ /// Initializes the service clients and the logging utility
61
+ /// </summary>
51
62
protected void InitializeAzureBackupCmdlet ( )
52
63
{
53
64
var cloudServicesClient = AzureSession . ClientFactory . CreateClient < CloudServiceManagementClient > ( DefaultContext , AzureEnvironment . Endpoint . ResourceManager ) ;
@@ -60,6 +71,11 @@ protected void InitializeAzureBackupCmdlet()
60
71
Logger . Instance = new Logger ( WriteWarning , WriteDebug , WriteVerbose , ThrowTerminatingError ) ;
61
72
}
62
73
74
+ /// <summary>
75
+ /// Wrapper method which executes the cmdlet processing blocks.
76
+ /// Catches and logs any exception occuring during the execution.
77
+ /// </summary>
78
+ /// <param name="action">Delegate representing the cmdlet processing block</param>
63
79
protected void ExecutionBlock ( Action action )
64
80
{
65
81
try
@@ -76,7 +92,7 @@ protected void ExecutionBlock(Action action)
76
92
/// <summary>
77
93
/// Handles set of exceptions thrown by client
78
94
/// </summary>
79
- /// <param name="ex"></param>
95
+ /// <param name="ex">Exception thrown by the client </param>
80
96
private void HandleException ( Exception exception )
81
97
{
82
98
if ( exception is AggregateException && ( ( AggregateException ) exception ) . InnerExceptions != null
@@ -137,11 +153,21 @@ protected override void BeginProcessing()
137
153
InitializeAzureBackupCmdlet ( ) ;
138
154
}
139
155
156
+ /// <summary>
157
+ /// Get the job PS model after fetching the job object from the service given the job ID.
158
+ /// </summary>
159
+ /// <param name="jobId">ID of the job to be fetched</param>
160
+ /// <returns></returns>
140
161
public CmdletModel . JobBase GetJobObject ( string jobId )
141
162
{
142
163
return JobConversions . GetPSJob ( ServiceClientAdapter . GetJob ( jobId ) ) ;
143
164
}
144
165
166
+ /// <summary>
167
+ /// Gets list of job PS models after fetching the job objects from the service given the list of job IDs.
168
+ /// </summary>
169
+ /// <param name="jobIds">List of IDs of jobs to be fetched</param>
170
+ /// <returns></returns>
145
171
public List < CmdletModel . JobBase > GetJobObject ( IList < string > jobIds )
146
172
{
147
173
List < CmdletModel . JobBase > result = new List < CmdletModel . JobBase > ( ) ;
@@ -152,6 +178,13 @@ public CmdletModel.JobBase GetJobObject(string jobId)
152
178
return result ;
153
179
}
154
180
181
+ /// <summary>
182
+ /// Block to track the operation to completion.
183
+ /// Waits till the status of the operation becomes something other than InProgress.
184
+ /// </summary>
185
+ /// <param name="statusUrlLink"></param>
186
+ /// <param name="serviceClientMethod"></param>
187
+ /// <returns></returns>
155
188
public BackUpOperationStatusResponse WaitForOperationCompletionUsingStatusLink (
156
189
string statusUrlLink ,
157
190
Func < string , BackUpOperationStatusResponse > serviceClientMethod )
@@ -174,6 +207,11 @@ public BackUpOperationStatusResponse WaitForOperationCompletionUsingStatusLink(
174
207
return response ;
175
208
}
176
209
210
+ /// <summary>
211
+ /// Based on the response from the service, handles the job created in the service appropriately.
212
+ /// </summary>
213
+ /// <param name="itemResponse">Response from service</param>
214
+ /// <param name="operationName">Name of the operation</param>
177
215
protected void HandleCreatedJob ( BaseRecoveryServicesJobResponse itemResponse , string operationName )
178
216
{
179
217
WriteDebug ( Resources . TrackingOperationStatusURLForCompletion +
0 commit comments