10
10
import com .azure .core .http .HttpPipelineBuilder ;
11
11
import com .azure .core .http .HttpPipelinePosition ;
12
12
import com .azure .core .http .policy .AddDatePolicy ;
13
+ import com .azure .core .http .policy .AddHeadersFromContextPolicy ;
13
14
import com .azure .core .http .policy .HttpLogOptions ;
14
15
import com .azure .core .http .policy .HttpLoggingPolicy ;
15
16
import com .azure .core .http .policy .HttpPipelinePolicy ;
16
17
import com .azure .core .http .policy .HttpPolicyProviders ;
17
18
import com .azure .core .http .policy .RequestIdPolicy ;
19
+ import com .azure .core .http .policy .RetryOptions ;
18
20
import com .azure .core .http .policy .RetryPolicy ;
19
21
import com .azure .core .http .policy .UserAgentPolicy ;
20
22
import com .azure .core .management .http .policy .ArmChallengeAuthenticationPolicy ;
33
35
import com .azure .resourcemanager .dataprotection .implementation .ExportJobsOperationResultsImpl ;
34
36
import com .azure .resourcemanager .dataprotection .implementation .JobsImpl ;
35
37
import com .azure .resourcemanager .dataprotection .implementation .OperationResultsImpl ;
38
+ import com .azure .resourcemanager .dataprotection .implementation .OperationStatusBackupVaultContextsImpl ;
36
39
import com .azure .resourcemanager .dataprotection .implementation .OperationStatusImpl ;
40
+ import com .azure .resourcemanager .dataprotection .implementation .OperationStatusResourceGroupContextsImpl ;
37
41
import com .azure .resourcemanager .dataprotection .implementation .RecoveryPointsImpl ;
38
42
import com .azure .resourcemanager .dataprotection .implementation .ResourceGuardsImpl ;
39
43
import com .azure .resourcemanager .dataprotection .implementation .RestorableTimeRangesImpl ;
48
52
import com .azure .resourcemanager .dataprotection .models .Jobs ;
49
53
import com .azure .resourcemanager .dataprotection .models .OperationResults ;
50
54
import com .azure .resourcemanager .dataprotection .models .OperationStatus ;
55
+ import com .azure .resourcemanager .dataprotection .models .OperationStatusBackupVaultContexts ;
56
+ import com .azure .resourcemanager .dataprotection .models .OperationStatusResourceGroupContexts ;
51
57
import com .azure .resourcemanager .dataprotection .models .RecoveryPoints ;
52
58
import com .azure .resourcemanager .dataprotection .models .ResourceGuards ;
53
59
import com .azure .resourcemanager .dataprotection .models .RestorableTimeRanges ;
@@ -66,6 +72,10 @@ public final class DataProtectionManager {
66
72
67
73
private OperationStatus operationStatus ;
68
74
75
+ private OperationStatusBackupVaultContexts operationStatusBackupVaultContexts ;
76
+
77
+ private OperationStatusResourceGroupContexts operationStatusResourceGroupContexts ;
78
+
69
79
private BackupVaultOperationResults backupVaultOperationResults ;
70
80
71
81
private DataProtections dataProtections ;
@@ -115,6 +125,19 @@ public static DataProtectionManager authenticate(TokenCredential credential, Azu
115
125
return configure ().authenticate (credential , profile );
116
126
}
117
127
128
+ /**
129
+ * Creates an instance of DataProtection service API entry point.
130
+ *
131
+ * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
132
+ * @param profile the Azure profile for client.
133
+ * @return the DataProtection service API instance.
134
+ */
135
+ public static DataProtectionManager authenticate (HttpPipeline httpPipeline , AzureProfile profile ) {
136
+ Objects .requireNonNull (httpPipeline , "'httpPipeline' cannot be null." );
137
+ Objects .requireNonNull (profile , "'profile' cannot be null." );
138
+ return new DataProtectionManager (httpPipeline , profile , null );
139
+ }
140
+
118
141
/**
119
142
* Gets a Configurable instance that can be used to create DataProtectionManager with optional configuration.
120
143
*
@@ -126,13 +149,14 @@ public static Configurable configure() {
126
149
127
150
/** The Configurable allowing configurations to be set. */
128
151
public static final class Configurable {
129
- private final ClientLogger logger = new ClientLogger (Configurable .class );
152
+ private static final ClientLogger LOGGER = new ClientLogger (Configurable .class );
130
153
131
154
private HttpClient httpClient ;
132
155
private HttpLogOptions httpLogOptions ;
133
156
private final List <HttpPipelinePolicy > policies = new ArrayList <>();
134
157
private final List <String > scopes = new ArrayList <>();
135
158
private RetryPolicy retryPolicy ;
159
+ private RetryOptions retryOptions ;
136
160
private Duration defaultPollInterval ;
137
161
138
162
private Configurable () {
@@ -193,16 +217,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
193
217
return this ;
194
218
}
195
219
220
+ /**
221
+ * Sets the retry options for the HTTP pipeline retry policy.
222
+ *
223
+ * <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
224
+ *
225
+ * @param retryOptions the retry options for the HTTP pipeline retry policy.
226
+ * @return the configurable object itself.
227
+ */
228
+ public Configurable withRetryOptions (RetryOptions retryOptions ) {
229
+ this .retryOptions = Objects .requireNonNull (retryOptions , "'retryOptions' cannot be null." );
230
+ return this ;
231
+ }
232
+
196
233
/**
197
234
* Sets the default poll interval, used when service does not provide "Retry-After" header.
198
235
*
199
236
* @param defaultPollInterval the default poll interval.
200
237
* @return the configurable object itself.
201
238
*/
202
239
public Configurable withDefaultPollInterval (Duration defaultPollInterval ) {
203
- this .defaultPollInterval = Objects .requireNonNull (defaultPollInterval , "'retryPolicy' cannot be null." );
240
+ this .defaultPollInterval =
241
+ Objects .requireNonNull (defaultPollInterval , "'defaultPollInterval' cannot be null." );
204
242
if (this .defaultPollInterval .isNegative ()) {
205
- throw logger .logExceptionAsError (new IllegalArgumentException ("'httpPipeline' cannot be negative" ));
243
+ throw LOGGER
244
+ .logExceptionAsError (new IllegalArgumentException ("'defaultPollInterval' cannot be negative" ));
206
245
}
207
246
return this ;
208
247
}
@@ -242,10 +281,15 @@ public DataProtectionManager authenticate(TokenCredential credential, AzureProfi
242
281
scopes .add (profile .getEnvironment ().getManagementEndpoint () + "/.default" );
243
282
}
244
283
if (retryPolicy == null ) {
245
- retryPolicy = new RetryPolicy ("Retry-After" , ChronoUnit .SECONDS );
284
+ if (retryOptions != null ) {
285
+ retryPolicy = new RetryPolicy (retryOptions );
286
+ } else {
287
+ retryPolicy = new RetryPolicy ("Retry-After" , ChronoUnit .SECONDS );
288
+ }
246
289
}
247
290
List <HttpPipelinePolicy > policies = new ArrayList <>();
248
291
policies .add (new UserAgentPolicy (userAgentBuilder .toString ()));
292
+ policies .add (new AddHeadersFromContextPolicy ());
249
293
policies .add (new RequestIdPolicy ());
250
294
policies
251
295
.addAll (
@@ -276,31 +320,74 @@ public DataProtectionManager authenticate(TokenCredential credential, AzureProfi
276
320
}
277
321
}
278
322
279
- /** @return Resource collection API of BackupVaults. */
323
+ /**
324
+ * Gets the resource collection API of BackupVaults.
325
+ *
326
+ * @return Resource collection API of BackupVaults.
327
+ */
280
328
public BackupVaults backupVaults () {
281
329
if (this .backupVaults == null ) {
282
330
this .backupVaults = new BackupVaultsImpl (clientObject .getBackupVaults (), this );
283
331
}
284
332
return backupVaults ;
285
333
}
286
334
287
- /** @return Resource collection API of OperationResults. */
335
+ /**
336
+ * Gets the resource collection API of OperationResults.
337
+ *
338
+ * @return Resource collection API of OperationResults.
339
+ */
288
340
public OperationResults operationResults () {
289
341
if (this .operationResults == null ) {
290
342
this .operationResults = new OperationResultsImpl (clientObject .getOperationResults (), this );
291
343
}
292
344
return operationResults ;
293
345
}
294
346
295
- /** @return Resource collection API of OperationStatus. */
347
+ /**
348
+ * Gets the resource collection API of OperationStatus.
349
+ *
350
+ * @return Resource collection API of OperationStatus.
351
+ */
296
352
public OperationStatus operationStatus () {
297
353
if (this .operationStatus == null ) {
298
354
this .operationStatus = new OperationStatusImpl (clientObject .getOperationStatus (), this );
299
355
}
300
356
return operationStatus ;
301
357
}
302
358
303
- /** @return Resource collection API of BackupVaultOperationResults. */
359
+ /**
360
+ * Gets the resource collection API of OperationStatusBackupVaultContexts.
361
+ *
362
+ * @return Resource collection API of OperationStatusBackupVaultContexts.
363
+ */
364
+ public OperationStatusBackupVaultContexts operationStatusBackupVaultContexts () {
365
+ if (this .operationStatusBackupVaultContexts == null ) {
366
+ this .operationStatusBackupVaultContexts =
367
+ new OperationStatusBackupVaultContextsImpl (clientObject .getOperationStatusBackupVaultContexts (), this );
368
+ }
369
+ return operationStatusBackupVaultContexts ;
370
+ }
371
+
372
+ /**
373
+ * Gets the resource collection API of OperationStatusResourceGroupContexts.
374
+ *
375
+ * @return Resource collection API of OperationStatusResourceGroupContexts.
376
+ */
377
+ public OperationStatusResourceGroupContexts operationStatusResourceGroupContexts () {
378
+ if (this .operationStatusResourceGroupContexts == null ) {
379
+ this .operationStatusResourceGroupContexts =
380
+ new OperationStatusResourceGroupContextsImpl (
381
+ clientObject .getOperationStatusResourceGroupContexts (), this );
382
+ }
383
+ return operationStatusResourceGroupContexts ;
384
+ }
385
+
386
+ /**
387
+ * Gets the resource collection API of BackupVaultOperationResults.
388
+ *
389
+ * @return Resource collection API of BackupVaultOperationResults.
390
+ */
304
391
public BackupVaultOperationResults backupVaultOperationResults () {
305
392
if (this .backupVaultOperationResults == null ) {
306
393
this .backupVaultOperationResults =
@@ -309,15 +396,23 @@ public BackupVaultOperationResults backupVaultOperationResults() {
309
396
return backupVaultOperationResults ;
310
397
}
311
398
312
- /** @return Resource collection API of DataProtections. */
399
+ /**
400
+ * Gets the resource collection API of DataProtections.
401
+ *
402
+ * @return Resource collection API of DataProtections.
403
+ */
313
404
public DataProtections dataProtections () {
314
405
if (this .dataProtections == null ) {
315
406
this .dataProtections = new DataProtectionsImpl (clientObject .getDataProtections (), this );
316
407
}
317
408
return dataProtections ;
318
409
}
319
410
320
- /** @return Resource collection API of DataProtectionOperations. */
411
+ /**
412
+ * Gets the resource collection API of DataProtectionOperations.
413
+ *
414
+ * @return Resource collection API of DataProtectionOperations.
415
+ */
321
416
public DataProtectionOperations dataProtectionOperations () {
322
417
if (this .dataProtectionOperations == null ) {
323
418
this .dataProtectionOperations =
@@ -326,55 +421,83 @@ public DataProtectionOperations dataProtectionOperations() {
326
421
return dataProtectionOperations ;
327
422
}
328
423
329
- /** @return Resource collection API of BackupPolicies. */
424
+ /**
425
+ * Gets the resource collection API of BackupPolicies.
426
+ *
427
+ * @return Resource collection API of BackupPolicies.
428
+ */
330
429
public BackupPolicies backupPolicies () {
331
430
if (this .backupPolicies == null ) {
332
431
this .backupPolicies = new BackupPoliciesImpl (clientObject .getBackupPolicies (), this );
333
432
}
334
433
return backupPolicies ;
335
434
}
336
435
337
- /** @return Resource collection API of BackupInstances. */
436
+ /**
437
+ * Gets the resource collection API of BackupInstances.
438
+ *
439
+ * @return Resource collection API of BackupInstances.
440
+ */
338
441
public BackupInstances backupInstances () {
339
442
if (this .backupInstances == null ) {
340
443
this .backupInstances = new BackupInstancesImpl (clientObject .getBackupInstances (), this );
341
444
}
342
445
return backupInstances ;
343
446
}
344
447
345
- /** @return Resource collection API of RecoveryPoints. */
448
+ /**
449
+ * Gets the resource collection API of RecoveryPoints.
450
+ *
451
+ * @return Resource collection API of RecoveryPoints.
452
+ */
346
453
public RecoveryPoints recoveryPoints () {
347
454
if (this .recoveryPoints == null ) {
348
455
this .recoveryPoints = new RecoveryPointsImpl (clientObject .getRecoveryPoints (), this );
349
456
}
350
457
return recoveryPoints ;
351
458
}
352
459
353
- /** @return Resource collection API of Jobs. */
460
+ /**
461
+ * Gets the resource collection API of Jobs.
462
+ *
463
+ * @return Resource collection API of Jobs.
464
+ */
354
465
public Jobs jobs () {
355
466
if (this .jobs == null ) {
356
467
this .jobs = new JobsImpl (clientObject .getJobs (), this );
357
468
}
358
469
return jobs ;
359
470
}
360
471
361
- /** @return Resource collection API of RestorableTimeRanges. */
472
+ /**
473
+ * Gets the resource collection API of RestorableTimeRanges.
474
+ *
475
+ * @return Resource collection API of RestorableTimeRanges.
476
+ */
362
477
public RestorableTimeRanges restorableTimeRanges () {
363
478
if (this .restorableTimeRanges == null ) {
364
479
this .restorableTimeRanges = new RestorableTimeRangesImpl (clientObject .getRestorableTimeRanges (), this );
365
480
}
366
481
return restorableTimeRanges ;
367
482
}
368
483
369
- /** @return Resource collection API of ExportJobs. */
484
+ /**
485
+ * Gets the resource collection API of ExportJobs.
486
+ *
487
+ * @return Resource collection API of ExportJobs.
488
+ */
370
489
public ExportJobs exportJobs () {
371
490
if (this .exportJobs == null ) {
372
491
this .exportJobs = new ExportJobsImpl (clientObject .getExportJobs (), this );
373
492
}
374
493
return exportJobs ;
375
494
}
376
495
377
- /** @return Resource collection API of ExportJobsOperationResults. */
496
+ /**
497
+ * Gets the resource collection API of ExportJobsOperationResults.
498
+ *
499
+ * @return Resource collection API of ExportJobsOperationResults.
500
+ */
378
501
public ExportJobsOperationResults exportJobsOperationResults () {
379
502
if (this .exportJobsOperationResults == null ) {
380
503
this .exportJobsOperationResults =
@@ -383,7 +506,11 @@ public ExportJobsOperationResults exportJobsOperationResults() {
383
506
return exportJobsOperationResults ;
384
507
}
385
508
386
- /** @return Resource collection API of ResourceGuards. */
509
+ /**
510
+ * Gets the resource collection API of ResourceGuards.
511
+ *
512
+ * @return Resource collection API of ResourceGuards.
513
+ */
387
514
public ResourceGuards resourceGuards () {
388
515
if (this .resourceGuards == null ) {
389
516
this .resourceGuards = new ResourceGuardsImpl (clientObject .getResourceGuards (), this );
0 commit comments