-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathDnsServiceExtensions.cs
More file actions
964 lines (877 loc) · 58.2 KB
/
Copy pathDnsServiceExtensions.cs
File metadata and controls
964 lines (877 loc) · 58.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
namespace net.openstack.Core.Synchronous
{
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Net;
using net.openstack.Core.Collections;
using net.openstack.Providers.Rackspace;
using net.openstack.Providers.Rackspace.Objects.Dns;
using Newtonsoft.Json;
using CancellationToken = System.Threading.CancellationToken;
using ServiceCatalog = net.openstack.Core.Domain.ServiceCatalog;
/// <summary>
/// Provides extension methods to allow synchronous calls to the methods in <see cref="IDnsService"/>.
/// </summary>
/// <preliminary/>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static class DnsServiceExtensions
{
#region Limits
/// <summary>
/// Get information about the provider-specific limits of this service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <returns>A <see cref="DnsServiceLimits"/> object containing detailed information about the limits for the service provider.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_All_Limits.html">List All Limits (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsServiceLimits ListLimits(this IDnsService service)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListLimitsAsync(CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Get information about the types of provider-specific limits in place for this service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <returns>A collection of <see cref="LimitType"/> objects containing the limit types supported by the service.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Limit_Types.html">List Limit Types (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static ReadOnlyCollection<LimitType> ListLimitTypes(this IDnsService service)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListLimitTypesAsync(CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Get information about the provider-specific limits of this service for a particular <see cref="LimitType"/>.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="type">The limit type.</param>
/// <returns>A <see cref="DnsServiceLimits"/> object containing detailed information about the limits of the specified <paramref name="type"/> for the service provider.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="service"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="type"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Specific_Limit.html">List Specific Limit (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsServiceLimits ListLimits(this IDnsService service, LimitType type)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListLimitsAsync(type, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion Limits
#region Jobs
/// <summary>
/// Gets information about an asynchronous task being executed by the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="job">The <see cref="DnsJob"/> to query.</param>
/// <param name="showDetails"><see langword="true"/> to include detailed information about the job; otherwise, <see langword="false"/>.</param>
/// <returns>A <see cref="DnsJob"/> object containing the updated job information.</returns>
/// <exception cref="ArgumentNullException">
/// If <paramref name="service"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="job"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/sync_asynch_responses.html">Synchronous and Asynchronous Responses (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob GetJobStatus(this IDnsService service, DnsJob job, bool showDetails)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.GetJobStatusAsync(job, showDetails, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Gets information about an asynchronous task with a strongly-typed result being executed by the DNS service.
/// </summary>
/// <typeparam name="TResponse">The class modeling the JSON result of the asynchronous operation.</typeparam>
/// <param name="service">The DNS service instance.</param>
/// <param name="job">The <see cref="DnsJob{TResponse}"/> to query.</param>
/// <param name="showDetails"><see langword="true"/> to include detailed information about the job; otherwise, <see langword="false"/>.</param>
/// <returns>A <see cref="DnsJob{TResult}"/> object containing the updated job information.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="service"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="job"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="JsonSerializationException">If an error occurs while deserializing the response object.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/sync_asynch_responses.html">Synchronous and Asynchronous Responses (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<TResponse> GetJobStatus<TResponse>(this IDnsService service, DnsJob<TResponse> job, bool showDetails)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.GetJobStatusAsync(job, showDetails, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion Jobs
#region Domains
/// <summary>
/// Gets information about domains currently listed in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainName">If specified, the list will be filtered to only include the specified domain and its subdomains (if any exist).</param>
/// <param name="offset">The index of the last item in the previous page of results. If not specified, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of domains to return in a single page.</param>
/// <returns>
/// A tuple of the resulting collection of <see cref="DnsDomain"/> objects and the total number of domains in
/// the list. If the total number of domains in the list is not available, the second element of the tuple will
/// be <see langword="null"/>.
/// </returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// If <paramref name="offset"/> is less than 0.
/// <para>-or-</para>
/// <para>If <paramref name="limit"/> is less than or equal to 0.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/list_domains.html">List Domains (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/search_domains_w_filters.html">Search Domains with Filtering (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static Tuple<ReadOnlyCollectionPage<DnsDomain>, int?> ListDomains(this IDnsService service, string domainName, int? offset, int? limit)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListDomainsAsync(domainName, offset, limit, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Gets detailed information about a specific domain.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="showRecords"><see langword="true"/> to populate the <see cref="DnsDomain.Records"/> property of the result; otherwise, <see langword="false"/>.</param>
/// <param name="showSubdomains"><see langword="true"/> to populate the <see cref="DnsDomain.Subdomains"/> property of the result; otherwise, <see langword="false"/>.</param>
/// <returns>A <see cref="DnsDomain"/> object containing the DNS information for the requested domain.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainId"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/list_domain_details.html">List Domain Details (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsDomain ListDomainDetails(this IDnsService service, DomainId domainId, bool showRecords, bool showSubdomains)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListDomainDetailsAsync(domainId, showRecords, showSubdomains, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Gets information about all changes made to a domain since a specified time.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="since">The timestamp of the earliest changes to consider. If this is <see langword="null"/>, a provider-specific default value is used.</param>
/// <returns>A <see cref="DnsDomainChanges"/> object describing the changes made to a domain registered in the DNS service.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainId"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Domain_Changes.html">List Domain Changes (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsDomainChanges ListDomainChanges(this IDnsService service, DomainId domainId, DateTimeOffset? since)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListDomainChangesAsync(domainId, since, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Exports a domain registered in the DNS service.
/// </summary>
/// <remarks>
/// The exported domain represents a single domain, and does not include subdomains.
///
/// <note>
/// The <see cref="SerializedDomainFormat.Bind9"/> format does not support comments, so any
/// comments associated with a domain or its records will not be included in the exported
/// result.
/// </note>
/// </remarks>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <returns>A <see cref="DnsJob{TResponse}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainId"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/export_domain.html">Export Domain (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<ExportedDomain> ExportDomain(this IDnsService service, DomainId domainId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ExportDomainAsync(domainId, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Registers one or more new domains in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="configuration">A <see cref="DnsConfiguration"/> object describing the domains to register in the DNS service.</param>
/// <returns>A <see cref="DnsJob{TResponse}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="configuration"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/create_domains.html">Create Domain(s) (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<DnsDomains> CreateDomains(this IDnsService service, DnsConfiguration configuration)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.CreateDomainsAsync(configuration, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Updates one or more domains in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="configuration">A <see cref="DnsUpdateConfiguration"/> object describing updates to apply to the domains.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="configuration"/> is <see langword="null"/>.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Modify_Domain_s_-d1e3848.html">Modify Domain(s) (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob UpdateDomains(this IDnsService service, DnsUpdateConfiguration configuration)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.UpdateDomainsAsync(configuration, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Clones a domain registered in the DNS service, optionally cloning its subdomains as well.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="cloneName">The name of the new (cloned) domain.</param>
/// <param name="cloneSubdomains"><see langword="true"/> to recursively clone subdomains; otherwise, <see langword="false"/> to only clone the top-level domain and its records. Cloned subdomain configurations are modified the same way that cloned top-level domain configurations are modified. If this is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="modifyRecordData"><see langword="true"/> to replace occurrences of the reference domain name with the new domain name in comments on the cloned (new) domain. If this is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="modifyEmailAddress"><see langword="true"/> to replace occurrences of the reference domain name with the new domain name in email addresses on the cloned (new) domain. If this is <see langword="null"/>, a provider-specific default value is used.</param>
/// <param name="modifyComment"><true>true</true> to replace occurrences of the reference domain name with the new domain name in data fields (of records) on the cloned (new) domain. Does not affect NS records. If this is <see langword="null"/>, a provider-specific default value is used.</param>
/// <returns>A <see cref="DnsJob{TResponse}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="domainId"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="cloneName"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="cloneName"/> is empty.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/clone_domain-dle846.html">Clone Domain (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<DnsDomains> CloneDomain(this IDnsService service, DomainId domainId, string cloneName, bool? cloneSubdomains, bool? modifyRecordData, bool? modifyEmailAddress, bool? modifyComment)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.CloneDomainAsync(domainId, cloneName, cloneSubdomains, modifyRecordData, modifyEmailAddress, modifyComment, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Imports domains into the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serializedDomains">A collection of <see cref="SerializedDomain"/> objects containing the serialized domain information to import.</param>
/// <returns>A <see cref="DnsJob{TResponse}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="serializedDomains"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException">If <paramref name="serializedDomains"/> is contains any <see langword="null"/> values.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/import_domain.html">Import Domain (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<DnsDomains> ImportDomain(this IDnsService service, IEnumerable<SerializedDomain> serializedDomains)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ImportDomainAsync(serializedDomains, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Removes one or more domains from the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainIds">A collection of IDs for the domains to remove. These are obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="deleteSubdomains"><see langword="true"/> to delete any subdomains associated with the specified domains; otherwise, <see langword="false"/> to promote any subdomains to top-level domains.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainIds"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException">If <paramref name="domainIds"/> contains any <see langword="null"/> values.</exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Remove_Domain_s_-d1e4022.html">Remove Domain(s) (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob RemoveDomains(this IDnsService service, IEnumerable<DomainId> domainIds, bool deleteSubdomains)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.RemoveDomainsAsync(domainIds, deleteSubdomains, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion
#region Subdomains
/// <summary>
/// Gets information about subdomains currently associated with a domain in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The top-level domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="offset">The index of the last item in the previous page of results. If not specified, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of subdomains to return in a single page.</param>
/// <returns>
/// A tuple of the resulting collection of <see cref="DnsSubdomain"/> objects and the total number
/// of domains in the list. If the total number of subdomains in the list is not available, the second
/// element of the tuple will be <see langword="null"/>.
/// </returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainId"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// If <paramref name="offset"/> is less than 0.
/// <para>-or-</para>
/// <para>If <paramref name="limit"/> is less than or equal to 0.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Subdomains-d1e4295.html">List Subdomains (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static Tuple<ReadOnlyCollectionPage<DnsSubdomain>, int?> ListSubdomains(this IDnsService service, DomainId domainId, int? offset, int? limit)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListSubdomainsAsync(domainId, offset, limit, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion
#region Records
/// <summary>
/// Gets information about records currently associated with a domain in the DNS service, optionally filtering the results
/// to include only records of a specific type, name, and/or data.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="recordType">The specific record type to consider, or <see langword="null"/> to consider all record types.</param>
/// <param name="recordName">The record name, which is matched to the <see cref="DnsRecord.Name"/> property, or <see langword="null"/> to consider all records.</param>
/// <param name="recordData">The record data, which is matched to the <see cref="DnsRecord.Data"/> property, or <see langword="null"/> to consider all records.</param>
/// <param name="offset">The index of the last item in the previous page of results. If not specified, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of records to return in a single page.</param>
/// <returns>
/// A tuple of the resulting collection of <see cref="DnsRecord"/> objects and the total number of records
/// in the list. If the total number of records in the list is not available, the second element of the
/// tuple will be <see langword="null"/>.
/// </returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">If <paramref name="domainId"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// If <paramref name="offset"/> is less than 0.
/// <para>-or-</para>
/// <para>If <paramref name="limit"/> is less than or equal to 0.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Records-d1e4629.html">List Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Search_Records-e338d7e0.html">Search Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static Tuple<ReadOnlyCollectionPage<DnsRecord>, int?> ListRecords(this IDnsService service, DomainId domainId, DnsRecordType recordType, string recordName, string recordData, int? offset, int? limit)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListRecordsAsync(domainId, recordType, recordName, recordData, offset, limit, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Gets detailed information about a specific DNS record.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="recordId">The record ID. This is obtained from <see cref="DnsRecord.Id">DnsRecord.Id</see>.</param>
/// <returns>A <see cref="DnsRecord"/> object containing the details of the specified DNS record.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="domainId"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="recordId"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/List_Record_Details-d1e4770.html">List Record Details (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsRecord ListRecordDetails(this IDnsService service, DomainId domainId, RecordId recordId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListRecordDetailsAsync(domainId, recordId, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Adds records to a domain in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="recordConfigurations">A collection of <see cref="DnsDomainRecordConfiguration"/> objects describing the records to add.</param>
/// <returns>A <see cref="DnsJob{TResponse}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="domainId"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="recordConfigurations"/> contains any <see langword="null"/> values.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Add_Records-d1e4895.html">Add Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<DnsRecordsList> AddRecords(this IDnsService service, DomainId domainId, IEnumerable<DnsDomainRecordConfiguration> recordConfigurations)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.AddRecordsAsync(domainId, recordConfigurations, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Updates domain records in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="recordConfigurations">A collection of <see cref="DnsDomainRecordUpdateConfiguration"/> objects describing the updates to apply to domain records.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="domainId"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="recordConfigurations"/> contains any <see langword="null"/> values.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Modify_Records-d1e5033.html">Modify Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob UpdateRecords(this IDnsService service, DomainId domainId, IEnumerable<DnsDomainRecordUpdateConfiguration> recordConfigurations)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.UpdateRecordsAsync(domainId, recordConfigurations, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Removes one or more domain records from the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="domainId">The domain ID. This is obtained from <see cref="DnsDomain.Id">DnsDomain.Id</see>.</param>
/// <param name="recordId">A collection of IDs for the records to remove. These are obtained from <see cref="DnsRecord.Id">DnsRecord.Id</see>.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="domainId"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="recordId"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="recordId"/> contains any <see langword="null"/> values.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/Remove_Records-d1e5188.html">Remove Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob RemoveRecords(this IDnsService service, DomainId domainId, IEnumerable<RecordId> recordId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.RemoveRecordsAsync(domainId, recordId, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion
#region Reverse DNS
/// <summary>
/// Gets information about reverse DNS records currently associated with a cloud resource in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serviceName">The name of the service which owns the cloud resource. This is obtained from <see cref="ServiceCatalog.Name"/>.</param>
/// <param name="deviceResourceUri">The absolute URI of the cloud resource.</param>
/// <param name="offset">The index of the last item in the previous page of results. If not specified, the list starts at the beginning.</param>
/// <param name="limit">The maximum number of records to return in a single page.</param>
/// <returns>
/// A tuple of the resulting collection of <see cref="DnsRecord"/> objects and the total number of domains
/// in the list. If the total number of subdomains in the list is not available, the second element of the
/// tuple will be <see langword="null"/>.
/// </returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="serviceName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="deviceResourceUri"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">If <paramref name="serviceName"/> is empty.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// If <paramref name="offset"/> is less than 0.
/// <para>-or-</para>
/// <para>If <paramref name="limit"/> is less than or equal to 0.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457000.html">List PTR Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static Tuple<ReadOnlyCollectionPage<DnsRecord>, int?> ListPtrRecords(this IDnsService service, string serviceName, Uri deviceResourceUri, int? offset, int? limit)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListPtrRecordsAsync(serviceName, deviceResourceUri, offset, limit, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Gets detailed information about a reverse DNS record currently associated with a cloud resource in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serviceName">The name of the service which owns the cloud resource. This is obtained from <see cref="ServiceCatalog.Name"/>.</param>
/// <param name="deviceResourceUri">The absolute URI of the cloud resource.</param>
/// <param name="recordId">The record ID. This is obtained from <see cref="DnsRecord.Id">DnsRecord.Id</see>.</param>
/// <returns>A <see cref="DnsRecord"/> object containing the details of the specified reverse DNS record.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="serviceName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="deviceResourceUri"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="recordId"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="serviceName"/> is empty.
/// <para>-or-</para>
/// <para>If <paramref name="recordId"/> is empty.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457001.html">List PTR Record Details (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsRecord ListPtrRecordDetails(this IDnsService service, string serviceName, Uri deviceResourceUri, RecordId recordId)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.ListPtrRecordDetailsAsync(serviceName, deviceResourceUri, recordId, CancellationToken.None).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Adds reverse DNS records to a cloud resource in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serviceName">The name of the service which owns the cloud resource. This is obtained from <see cref="ServiceCatalog.Name"/>.</param>
/// <param name="deviceResourceUri">The absolute URI of the cloud resource.</param>
/// <param name="recordConfigurations">A collection of <see cref="DnsDomainRecordConfiguration"/> objects describing the records to add.</param>
/// <returns>A <see cref="DnsJob{DnsRecordsList}"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="serviceName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="deviceResourceUri"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="serviceName"/> is empty.
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> contains any <see langword="null"/> values.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457003.html">Add PTR Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob<DnsRecordsList> AddPtrRecords(this IDnsService service, string serviceName, Uri deviceResourceUri, IEnumerable<DnsDomainRecordConfiguration> recordConfigurations)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.AddPtrRecordsAsync(serviceName, deviceResourceUri, recordConfigurations, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Update reverse DNS records for a cloud resource in the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serviceName">The name of the service which owns the cloud resource. This is obtained from <see cref="ServiceCatalog.Name"/>.</param>
/// <param name="deviceResourceUri">The absolute URI of the cloud resource.</param>
/// <param name="recordConfigurations">A collection of <see cref="DnsDomainRecordUpdateConfiguration"/> objects describing the updates to apply to domain records.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="serviceName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="deviceResourceUri"/> is <see langword="null"/>.</para>
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="serviceName"/> is empty.
/// <para>-or-</para>
/// <para>If <paramref name="recordConfigurations"/> contains any <see langword="null"/> values.</para>
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457004.html">Modify PTR Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob UpdatePtrRecords(this IDnsService service, string serviceName, Uri deviceResourceUri, IEnumerable<DnsDomainRecordUpdateConfiguration> recordConfigurations)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.UpdatePtrRecordsAsync(serviceName, deviceResourceUri, recordConfigurations, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
/// <summary>
/// Removes one or more reverse DNS records from the DNS service.
/// </summary>
/// <param name="service">The DNS service instance.</param>
/// <param name="serviceName">The name of the service which owns the cloud resource. This is obtained from <see cref="ServiceCatalog.Name"/>.</param>
/// <param name="deviceResourceUri">The absolute URI of the cloud resource.</param>
/// <param name="ipAddress">The specific record to remove. If this is <see langword="null"/>, all reverse DNS records associated with the specified device are removed.</param>
/// <returns>A <see cref="DnsJob"/> object describing the asynchronous server operation.</returns>
/// <exception cref="ArgumentNullException">If <paramref name="service"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException">
/// If <paramref name="serviceName"/> is <see langword="null"/>.
/// <para>-or-</para>
/// <para>If <paramref name="deviceResourceUri"/> is <see langword="null"/>.</para>
/// </exception>
/// <exception cref="ArgumentException">
/// If <paramref name="serviceName"/> is empty.
/// </exception>
/// <exception cref="WebException">If the REST request does not return successfully.</exception>
/// <seealso href="http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457005.html">Remove PTR Records (Rackspace Cloud DNS Developer Guide - API v1.0)</seealso>
[Obsolete("These synchronous wrappers should not be used. For more information, see http://blogs.msdn.com/b/pfxteam/archive/2012/04/13/10293638.aspx.")]
public static DnsJob RemovePtrRecords(this IDnsService service, string serviceName, Uri deviceResourceUri, IPAddress ipAddress)
{
if (service == null)
throw new ArgumentNullException("service");
try
{
return service.RemovePtrRecordsAsync(serviceName, deviceResourceUri, ipAddress, AsyncCompletionOption.RequestSubmitted, CancellationToken.None, null).Result;
}
catch (AggregateException ex)
{
ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions;
if (innerExceptions.Count == 1)
throw innerExceptions[0];
throw;
}
}
#endregion
}
}