/
PrivateDnsExtensions.cs
362 lines (326 loc) · 22.9 KB
/
PrivateDnsExtensions.cs
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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// <auto-generated/>
#nullable disable
using System;
using System.Threading;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.ResourceManager;
using Azure.ResourceManager.PrivateDns.Mocking;
using Azure.ResourceManager.Resources;
namespace Azure.ResourceManager.PrivateDns
{
/// <summary> A class to add extension methods to Azure.ResourceManager.PrivateDns. </summary>
public static partial class PrivateDnsExtensions
{
private static MockablePrivateDnsArmClient GetMockablePrivateDnsArmClient(ArmClient client)
{
return client.GetCachedClient(client0 => new MockablePrivateDnsArmClient(client0));
}
private static MockablePrivateDnsResourceGroupResource GetMockablePrivateDnsResourceGroupResource(ArmResource resource)
{
return resource.GetCachedClient(client => new MockablePrivateDnsResourceGroupResource(client, resource.Id));
}
private static MockablePrivateDnsSubscriptionResource GetMockablePrivateDnsSubscriptionResource(ArmResource resource)
{
return resource.GetCachedClient(client => new MockablePrivateDnsSubscriptionResource(client, resource.Id));
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsZoneResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsZoneResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsZoneResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsZoneResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsZoneResource"/> object. </returns>
public static PrivateDnsZoneResource GetPrivateDnsZoneResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsZoneResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="VirtualNetworkLinkResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="VirtualNetworkLinkResource.CreateResourceIdentifier" /> to create a <see cref="VirtualNetworkLinkResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetVirtualNetworkLinkResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="VirtualNetworkLinkResource"/> object. </returns>
public static VirtualNetworkLinkResource GetVirtualNetworkLinkResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetVirtualNetworkLinkResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsARecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsARecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsARecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsARecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsARecordResource"/> object. </returns>
public static PrivateDnsARecordResource GetPrivateDnsARecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsARecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsAaaaRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsAaaaRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsAaaaRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsAaaaRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsAaaaRecordResource"/> object. </returns>
public static PrivateDnsAaaaRecordResource GetPrivateDnsAaaaRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsAaaaRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsCnameRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsCnameRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsCnameRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsCnameRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsCnameRecordResource"/> object. </returns>
public static PrivateDnsCnameRecordResource GetPrivateDnsCnameRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsCnameRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsMXRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsMXRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsMXRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsMXRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsMXRecordResource"/> object. </returns>
public static PrivateDnsMXRecordResource GetPrivateDnsMXRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsMXRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsPtrRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsPtrRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsPtrRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsPtrRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsPtrRecordResource"/> object. </returns>
public static PrivateDnsPtrRecordResource GetPrivateDnsPtrRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsPtrRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsSoaRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsSoaRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsSoaRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsSoaRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsSoaRecordResource"/> object. </returns>
public static PrivateDnsSoaRecordResource GetPrivateDnsSoaRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsSoaRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsSrvRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsSrvRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsSrvRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsSrvRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsSrvRecordResource"/> object. </returns>
public static PrivateDnsSrvRecordResource GetPrivateDnsSrvRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsSrvRecordResource(id);
}
/// <summary>
/// Gets an object representing a <see cref="PrivateDnsTxtRecordResource" /> along with the instance operations that can be performed on it but with no data.
/// You can use <see cref="PrivateDnsTxtRecordResource.CreateResourceIdentifier" /> to create a <see cref="PrivateDnsTxtRecordResource" /> <see cref="ResourceIdentifier" /> from its components.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsArmClient.GetPrivateDnsTxtRecordResource(ResourceIdentifier)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="client"> The <see cref="ArmClient" /> instance the method will execute against. </param>
/// <param name="id"> The resource ID of the resource to get. </param>
/// <exception cref="ArgumentNullException"> <paramref name="client"/> is null. </exception>
/// <returns> Returns a <see cref="PrivateDnsTxtRecordResource"/> object. </returns>
public static PrivateDnsTxtRecordResource GetPrivateDnsTxtRecordResource(this ArmClient client, ResourceIdentifier id)
{
Argument.AssertNotNull(client, nameof(client));
return GetMockablePrivateDnsArmClient(client).GetPrivateDnsTxtRecordResource(id);
}
/// <summary>
/// Gets a collection of PrivateDnsZoneResources in the ResourceGroupResource.
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsResourceGroupResource.GetPrivateDnsZones()"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> is null. </exception>
/// <returns> An object representing collection of PrivateDnsZoneResources and their operations over a PrivateDnsZoneResource. </returns>
public static PrivateDnsZoneCollection GetPrivateDnsZones(this ResourceGroupResource resourceGroupResource)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
return GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZones();
}
/// <summary>
/// Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or the record sets within the zone.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateZones_Get</description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsResourceGroupResource.GetPrivateDnsZoneAsync(string,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <param name="privateZoneName"> The name of the Private DNS zone (without a terminating dot). </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> or <paramref name="privateZoneName"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="privateZoneName"/> is an empty string, and was expected to be non-empty. </exception>
[ForwardsClientCalls]
public static async Task<Response<PrivateDnsZoneResource>> GetPrivateDnsZoneAsync(this ResourceGroupResource resourceGroupResource, string privateZoneName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
return await GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZoneAsync(privateZoneName, cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Gets a Private DNS zone. Retrieves the zone properties, but not the virtual networks links or the record sets within the zone.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/privateDnsZones/{privateZoneName}</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateZones_Get</description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsResourceGroupResource.GetPrivateDnsZone(string,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="resourceGroupResource"> The <see cref="ResourceGroupResource" /> instance the method will execute against. </param>
/// <param name="privateZoneName"> The name of the Private DNS zone (without a terminating dot). </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="resourceGroupResource"/> or <paramref name="privateZoneName"/> is null. </exception>
/// <exception cref="ArgumentException"> <paramref name="privateZoneName"/> is an empty string, and was expected to be non-empty. </exception>
[ForwardsClientCalls]
public static Response<PrivateDnsZoneResource> GetPrivateDnsZone(this ResourceGroupResource resourceGroupResource, string privateZoneName, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource));
return GetMockablePrivateDnsResourceGroupResource(resourceGroupResource).GetPrivateDnsZone(privateZoneName, cancellationToken);
}
/// <summary>
/// Lists the Private DNS zones in all resource groups in a subscription.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateZones_List</description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsSubscriptionResource.GetPrivateDnsZones(int?,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="subscriptionResource"> The <see cref="SubscriptionResource" /> instance the method will execute against. </param>
/// <param name="top"> The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionResource"/> is null. </exception>
/// <returns> An async collection of <see cref="PrivateDnsZoneResource"/> that may take multiple service requests to iterate over. </returns>
public static AsyncPageable<PrivateDnsZoneResource> GetPrivateDnsZonesAsync(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
return GetMockablePrivateDnsSubscriptionResource(subscriptionResource).GetPrivateDnsZonesAsync(top, cancellationToken);
}
/// <summary>
/// Lists the Private DNS zones in all resource groups in a subscription.
/// <list type="bullet">
/// <item>
/// <term>Request Path</term>
/// <description>/subscriptions/{subscriptionId}/providers/Microsoft.Network/privateDnsZones</description>
/// </item>
/// <item>
/// <term>Operation Id</term>
/// <description>PrivateZones_List</description>
/// </item>
/// </list>
/// <item>
/// <term>Mocking</term>
/// <description>To mock this method, please mock <see cref="MockablePrivateDnsSubscriptionResource.GetPrivateDnsZones(int?,CancellationToken)"/> instead.</description>
/// </item>
/// </summary>
/// <param name="subscriptionResource"> The <see cref="SubscriptionResource" /> instance the method will execute against. </param>
/// <param name="top"> The maximum number of Private DNS zones to return. If not specified, returns up to 100 zones. </param>
/// <param name="cancellationToken"> The cancellation token to use. </param>
/// <exception cref="ArgumentNullException"> <paramref name="subscriptionResource"/> is null. </exception>
/// <returns> A collection of <see cref="PrivateDnsZoneResource"/> that may take multiple service requests to iterate over. </returns>
public static Pageable<PrivateDnsZoneResource> GetPrivateDnsZones(this SubscriptionResource subscriptionResource, int? top = null, CancellationToken cancellationToken = default)
{
Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource));
return GetMockablePrivateDnsSubscriptionResource(subscriptionResource).GetPrivateDnsZones(top, cancellationToken);
}
}
}