functions/Add-DoPxDnsRecord.ps1

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
<#############################################################################
The DoPx module provides a rich set of commands that extend the automation
capabilities of the DigitalOcean (DO) cloud service. These commands make it
easier to manage your DigitalOcean environment from Windows PowerShell. When
used with the LinuxPx module, you can manage your entire DigitalOcean
environment from one shell.
 
Copyright 2014 Kirk Munro
 
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
#############################################################################>


<#
.SYNOPSIS
    Creates a new DNS record in your DigitalOcean environment.
.DESCRIPTION
    The Add-DoPxDnsRecord command creates a new DNS record in your DigitalOcean environment.
 
    You can create A, AAAA, CNAME, MX, TXT, SRV, and NS records with this command. Select the appropriate switch to identify the type of record that you want to create.
.INPUTS
    None
.OUTPUTS
    digitalocean.domainrecord
.NOTES
    This command sends an HTTP POST request that includes your access token to a DigitalOcean REST API v2 endpoint. To learn more about the DigitalOcean REST API, consult the DigitalOcean API documentation online at https://developers.digitalocean.com.
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -A -HostName subdomain -IPv4Address 127.0.0.1
 
    This command creates a new A record for domain example.com, with the subdomain "subdomain" routed to IP address 127.0.0.1.
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -AAAA -HostName subdomain -IPv6Address 2001:db8::ff00:42:8329
 
    This command creates a new AAAA record for domain example.com, with the subdomain "subdomain" routed to IP address 2001:db8::ff00:42:8329.
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -CNAME -AliasName newalias -HostName hosttarget
 
    This command creates a new CNAME record for domain example.com, with the "newalias" alias routed to host "hosttarget".
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -MX -HostName 127.0.0.1 -Priority 5
 
    This command creates a new MX record for domain example.com, routing mail traffic to host 127.0.0.1 with a priority of 5.
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -TXT -RecordName recordname -Message 'arbitrary data here'
 
    This command creates a new TXT record for domain example.com, with the record named "recordname" containing the message "arbitrary data here".
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -SRV -ServiceName servicename -HostName targethost -Priority 0 -Port 1 -Weight 2
 
    This command creates a new SRV record for domain example.com, directing service requests for service "servicename" to host "targethost" on port 1 with a priority of 0 and a weight of 2.
.EXAMPLE
    PS C:\> $accessToken = ConvertTo-SecureString -String a91a22c7d3c572306e9d6ebfce5f1f697bd7fe8d910d9497ca0f75de2bb37a32 -AsPlainText -Force
    PS C:\> Set-DoPxDefaultAccessToken -AccessToken $accessToken
    PS C:\> Add-DoPxDnsRecord -DomainName example.com -NS -NameServer ns1.digitalocean.com
 
    This command creates a new NS record for domain example.com, identifying name server ns1.digitalocean.com as authoritative for the domain.
.LINK
    Get-DoPxDomain
.LINK
    Get-DoPxDnsRecord
.LINK
    Remove-DoPxDnsRecord
.LINK
    Rename-DoPxDnsRecord
#>

function Add-DoPxDnsRecord {
    [CmdletBinding(SupportsShouldProcess=$true, DefaultParameterSetName='A')]
    [OutputType('digitalocean.domainrecord')]
    param(
        # The name of the domain to which this DNS record will be added.
        [Parameter(Position=0, Mandatory=$true, ValueFromPipelineByPropertyName=$true)]
        [ValidateNotNullOrEmpty()]
        [Alias('Name')]
        [System.String]
        $DomainName,

        # Creates an A record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='A')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the A parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $A,

        # Creates an AAAA record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='AAAA')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the AAAA parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $AAAA,

        # Creates a CNAME record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='CNAME')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the CNAME parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $CNAME,

        # Creates a MX record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='MX')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the MX parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $MX,

        # Creates a TXT record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='TXT')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the TXT parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $TXT,

        # Creates a SRV record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the SRV parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $SRV,

        # Creates a NS record.
        [Parameter(Position=1, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='NS')]
        [ValidateNotNull()]
        [ValidateScript({
            if (-not $_.IsPresent) {
                throw 'Passing false into the NS parameter is not supported.'
            }
            $true
        })]
        [System.Management.Automation.SwitchParameter]
        $NS,

        # The name of the new alias.
        [Parameter(Position=2, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='CNAME')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $AliasName,

        # The name of the record.
        [Parameter(Position=2, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='TXT')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $RecordName,

        # The name for the service being configured.
        [Parameter(Position=2, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $ServiceName,

        # This parameter has different meanings for different DNS record types, as follows:
        #
        # -- A: The host name, or subdomain, to configure.
        #
        # -- AAAA: The host name, or subdomain, to configure.
        #
        # -- CNAME: The host name that will be given to clients requesting the alias.
        #
        # -- MX: The host name or IP address that mail should be routed to.
        #
        # -- SRV: The host name to direct requests for the service to.
        [Parameter(Position=2, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='A')]
        [Parameter(Position=2, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='AAAA')]
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='CNAME')]
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='MX')]
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $HostName,

        # The IPv4 IP address to route requests to.
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='A')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $IPv4Address,

        # The IPv6 IP address to route requests to.
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='AAAA')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $IPv6Address,

        # The arbitrary text message.
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='TXT')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $Message,

        # The name of a name server that is authoritative for the domain.
        [Parameter(Position=3, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='NS')]
        [ValidateNotNullOrEmpty()]
        [System.String]
        $NameServer,

        # The priority of the target host. Lower values have higher priority. Valid priorities are numbers between 0 and 65535.
        [Parameter(Position=4, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='MX')]
        [Parameter(Position=4, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNull()]
        [ValidateRange(0,65535)]
        [System.Int32]
        $Priority,

        # The port where the service is found on the target host. A valid port is an number between 1 and 65535.
        [Parameter(Position=5, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNull()]
        [ValidateRange(1,65535)]
        [System.Int32]
        $Port,

        # The relative weight of targets for the service that have the same priority. A larger value has a higher priority. Valid weights are between 0 and 65535.
        [Parameter(Position=6, Mandatory=$true, ValueFromPipelineByPropertyName=$true, ParameterSetName='SRV')]
        [ValidateNotNull()]
        [ValidateRange(0,65535)]
        [System.Int32]
        $Weight,

        # The access token for your DigitalOcean environment, in secure string format.
        [Parameter()]
        [ValidateNotNull()]
        [System.Security.SecureString]
        $AccessToken
    )
    process {
        try {
            switch ($PSCmdlet.ParameterSetName) {
                'A' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                type = 'A'
                                name = $HostName
                                data = $IPv4Address
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('A') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('HostName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('IPv4Address') > $null

                            #endregion
                        }
                    }
                    break
                }
                'AAAA' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                type = 'AAAA'
                                name = $HostName
                                data = $IPv6Address
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('AAAA') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('HostName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('IPv6Address') > $null

                            #endregion
                        }
                    }
                    break
                }
                'CNAME' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                type = 'CNAME'
                                name = $AliasName
                                data = $HostName
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('CNAME') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('AliasName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('HostName') > $null

                            #endregion
                        }
                    }
                    break
                }
                'MX' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                    type = 'MX'
                                    data = $HostName
                                priority = $Priority
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('MX') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('HostName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('Priority') > $null

                            #endregion
                        }
                    }
                    break
                }
                'TXT' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                type = 'TXT'
                                name = $RecordName
                                data = $Message
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('TXT') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('RecordName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('Message') > $null

                            #endregion
                        }
                    }
                    break
                }
                'SRV' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                    type = 'SRV'
                                    name = $ServiceName
                                    data = $HostName
                                    port = $Port
                                priority = $Priority
                                  weight = $Weight
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('SRV') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('ServiceName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('HostName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('Port') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('Priority') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('Weight') > $null

                            #endregion
                        }
                    }
                    break
                }
                'NS' {
                    Invoke-Snippet -Name ProxyFunction.Begin -Parameters @{
                        CommandName = 'New-DoPxObject'
                        CommandType = 'Function'
                        PreProcessScriptBlock = {
                            #region Identify the endpoint that is used when creating a DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['RelativeUri'] = 'domains'
                            $PSCmdlet.MyInvocation.BoundParameters['Id'] = $DomainName
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('DomainName') > $null
                            $PSCmdlet.MyInvocation.BoundParameters['RelatedObjectUri'] = 'records'

                            #endregion

                            #region Identify the properties that will be assigned to the new DNS record.

                            $PSCmdlet.MyInvocation.BoundParameters['Property'] = @{
                                type = 'NS'
                                data = $NameServer -replace '([^\.])$','$1.'
                            }
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('NS') > $null
                            $PSCmdlet.MyInvocation.BoundParameters.Remove('NameServer') > $null

                            #endregion
                        }
                    }
                    break
                }
            }
            Invoke-Snippet -Name ProxyFunction.Process.NoPipeline
            Invoke-Snippet -Name ProxyFunction.End
        } catch {
            $PSCmdlet.ThrowTerminatingError($_)
        }
    }
}

Export-ModuleMember -Function Add-DoPxDnsRecord
# SIG # Begin signature block
# MIIZIAYJKoZIhvcNAQcCoIIZETCCGQ0CAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUngzjPnY3hblwOxA2AZc0kdsZ
# ne+gghRWMIID7jCCA1egAwIBAgIQfpPr+3zGTlnqS5p31Ab8OzANBgkqhkiG9w0B
# AQUFADCBizELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIG
# A1UEBxMLRHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhh
# d3RlIENlcnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcg
# Q0EwHhcNMTIxMjIxMDAwMDAwWhcNMjAxMjMwMjM1OTU5WjBeMQswCQYDVQQGEwJV
# UzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xMDAuBgNVBAMTJ1N5bWFu
# dGVjIFRpbWUgU3RhbXBpbmcgU2VydmljZXMgQ0EgLSBHMjCCASIwDQYJKoZIhvcN
# AQEBBQADggEPADCCAQoCggEBALGss0lUS5ccEgrYJXmRIlcqb9y4JsRDc2vCvy5Q
# WvsUwnaOQwElQ7Sh4kX06Ld7w3TMIte0lAAC903tv7S3RCRrzV9FO9FEzkMScxeC
# i2m0K8uZHqxyGyZNcR+xMd37UWECU6aq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