AZURE_DNS: Adopt new "armdns" SDK (#1701)

* Switch to the new Azure sdk for go

* use codeql 1.18 as 1.17 doesn't work with azidentity

Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Vatsalya Goel 2022-08-14 15:42:41 +04:00 committed by GitHub
parent 09a53b4d68
commit 5e8bb6e461
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 183 additions and 190 deletions

View file

@ -38,6 +38,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.18
if: ${{ matrix.language == 'go' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2

18
go.mod
View file

@ -5,8 +5,8 @@ go 1.18
require gopkg.in/yaml.v3 v3.0.1 // indirect
require (
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.0.0
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/DisposaBoy/JsonConfigReader v0.0.0-20201129172854-99cf318d67e7
github.com/PuerkitoBio/goquery v1.8.0
@ -68,13 +68,10 @@ require (
require (
cloud.google.com/go/compute v1.7.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.24 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 // indirect
github.com/GeertJohan/go.rice v1.0.2 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
@ -94,11 +91,10 @@ require (
github.com/daaku/go.zipexe v1.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deepmap/oapi-codegen v1.9.1 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
@ -129,6 +125,7 @@ require (
github.com/juju/errors v0.0.0-20200330140219-3fe23663418f // indirect
github.com/juju/testing v0.0.0-20210324180055-18c50b0c2098 // indirect
github.com/kolo/xmlrpc v0.0.0-20201022064351-38db28db192b // indirect
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
@ -139,6 +136,7 @@ require (
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/peterhellberg/link v1.1.0 // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect

43
go.sum
View file

@ -55,28 +55,20 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible h1:bmmC38SlE8/E81nNADlgmVGurPWMHDX2YNXVQMrBpEE=
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k=
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0 h1:QkAcEIAKbNL4KoFr4SathZPhDhF4mVwpBMFlYjyAqy8=
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.1.0/go.mod h1:bhXu1AjYL+wutSL/kpSq6s7733q2Rb0yuot9Zgfqa/0=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY=
github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.0.0 h1:yxl7xvG5sSVlR74BqjIg+dnoE82jeolZF62X1gMT2VY=
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.0.0/go.mod h1:eADizCOKKdr+Q+7TFPNaPh+MIjbfJ42F0snpJZwRAtU=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.24 h1:1fIGgHKqVm54KIPT+q8Zmd1QlVsmHqeUGso5qm2BqqE=
github.com/Azure/go-autorest/autorest v0.11.24/go.mod h1:G6kyRlFnTuSbEYkQGawPfsCswgme4iYf6rfSKUDzbCc=
github.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ=
github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 h1:P6bYXFoao05z5uhOQzbC3Qd8JqF3jUoocoTeIxkp2cA=
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11/go.mod h1:84w/uV8E37feW2NCJ08uT9VBfjfUHpgLVnG2InYD6cg=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 h1:0W/yGmFdTIT77fvdlGZ0LMISoLHFJ7Tx4U0yeB+uFs4=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5/go.mod h1:ADQAXrkgm7acgWVUNamOgh8YNrv4p27l3Wc55oVfpzg=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk=
github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE=
github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1 h1:BWe8a+f/t+7KY7zH2mqygeUD0t8hNFXe08p1Pb3/jKE=
github.com/AzureAD/microsoft-authentication-library-for-go v0.5.1/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
@ -187,11 +179,10 @@ github.com/deepmap/oapi-codegen v1.9.1 h1:yHmEnA7jSTUMQgV+uN02WpZtwHnz2CBW3mZRIx
github.com/deepmap/oapi-codegen v1.9.1/go.mod h1:PLqNAhdedP8ttRpBBkzLKU3bp+Fpy+tTgeAMlztR2cw=
github.com/digitalocean/godo v1.81.0 h1:sjb3fOfPfSlUQUK22E87BcI8Zx2qtnF7VUCCO4UK3C8=
github.com/digitalocean/godo v1.81.0/go.mod h1:BPCqvwbjbGqxuUnIKB4EvS/AX7IDnNmt5fwvIkWo+ew=
github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U=
github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
github.com/ditashi/jsbeautifier-go v0.0.0-20141206144643-2520a8026a9c h1:+Zo5Ca9GH0RoeVZQKzFJcTLoAixx5s5Gq3pTIS+n354=
github.com/ditashi/jsbeautifier-go v0.0.0-20141206144643-2520a8026a9c/go.mod h1:HJGU9ULdREjOcVGZVPB5s6zYmHi1RxzT71l2wQyLmnE=
github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE=
github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c=
github.com/dnsimple/dnsimple-go v0.71.1 h1:1hGoBA3CIjpjZj5DM3081xfxr4e2jYmYnkO2VuBF8Qc=
github.com/dnsimple/dnsimple-go v0.71.1/go.mod h1:F9WHww9cC76hrnwGFfAfrqdW99j3MOYasQcIwTS/aUk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
@ -247,10 +238,10 @@ github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGF
github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU=
github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@ -473,6 +464,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/labstack/echo/v4 v4.6.3/go.mod h1:Hk5OiHj0kDqmFq7aHe7eDqI7CUhuCrfpupQtLGGLm7A=
github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
@ -532,6 +525,7 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 h1:o6uBwrhM5C8Ll3MAAxrQxRHEu7FkapwTuI2WmL1rw4g=
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8=
@ -556,6 +550,8 @@ github.com/philhug/opensrs-go v0.0.0-20171126225031-9dfa7433020d h1:nf4+lHs8TQeI
github.com/philhug/opensrs-go v0.0.0-20171126225031-9dfa7433020d/go.mod h1:VDIGNBy0tHXMDAu4gxHFQJDq3NuwqUxw2Kok7wi+6ck=
github.com/pierrec/lz4 v2.6.0+incompatible h1:Ix9yFKn1nSPBLFl/yZknTp8TU5G4Ps0JDmguYK6iH1A=
github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI=
github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@ -678,7 +674,6 @@ golang.org/x/crypto v0.0.0-20201217014255-9d1352758620/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -763,7 +758,6 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
@ -848,6 +842,7 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

View file

@ -4,17 +4,17 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/StackExchange/dnscontrol/v3/pkg/printer"
"sort"
"strings"
"time"
adns "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2018-05-01/dns"
aauth "github.com/Azure/go-autorest/autorest/azure/auth"
aauth "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
adns "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns"
"github.com/Azure/go-autorest/autorest/to"
"github.com/StackExchange/dnscontrol/v3/models"
"github.com/StackExchange/dnscontrol/v3/pkg/diff"
"github.com/StackExchange/dnscontrol/v3/pkg/printer"
"github.com/StackExchange/dnscontrol/v3/pkg/txtutil"
"github.com/StackExchange/dnscontrol/v3/providers"
)
@ -33,19 +33,21 @@ func newAzureDNSDsp(conf map[string]string, metadata json.RawMessage) (providers
func newAzureDNS(m map[string]string, metadata json.RawMessage) (*azurednsProvider, error) {
subID, rg := m["SubscriptionID"], m["ResourceGroup"]
zonesClient := adns.NewZonesClient(subID)
recordsClient := adns.NewRecordSetsClient(subID)
clientCredentialAuthorizer := aauth.NewClientCredentialsConfig(m["ClientID"], m["ClientSecret"], m["TenantID"])
authorizer, authErr := clientCredentialAuthorizer.Authorizer()
clientID, clientSecret, tenantID := m["ClientID"], m["ClientSecret"], m["TenantID"]
credential, authErr := aauth.NewClientSecretCredential(tenantID, clientID, clientSecret, nil)
if authErr != nil {
return nil, authErr
}
zonesClient, zoneErr := adns.NewZonesClient(subID, credential, nil)
if zoneErr != nil {
return nil, zoneErr
}
recordsClient, recordErr := adns.NewRecordSetsClient(subID, credential, nil)
if recordErr != nil {
return nil, recordErr
}
zonesClient.Authorizer = authorizer
recordsClient.Authorizer = authorizer
api := &azurednsProvider{zonesClient: &zonesClient, recordsClient: &recordsClient, resourceGroup: to.StringPtr(rg), subscriptionID: to.StringPtr(subID)}
api := &azurednsProvider{zonesClient: zonesClient, recordsClient: recordsClient, resourceGroup: to.StringPtr(rg), subscriptionID: to.StringPtr(subID)}
err := api.getZones()
if err != nil {
return nil, err
@ -77,40 +79,33 @@ func init() {
providers.RegisterCustomRecordType("AZURE_ALIAS", "AZURE_DNS", "")
}
func (a *azurednsProvider) getExistingZones() (*adns.ZoneListResult, error) {
// Please note — this function doesn't work with > 100 zones
// https://github.com/StackExchange/dnscontrol/issues/792
// Copied this code to getZones and ListZones and modified it for using a paging
// As a result getExistingZones is not used anymore
func (a *azurednsProvider) getExistingZones() ([]*adns.Zone, error) {
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
zonesIterator, zonesErr := a.zonesClient.ListByResourceGroupComplete(ctx, *a.resourceGroup, to.Int32Ptr(100))
zonesPager := a.zonesClient.NewListByResourceGroupPager(*a.resourceGroup, nil)
var zones []*adns.Zone
for zonesPager.More() {
nextResult, zonesErr := zonesPager.NextPage(ctx)
if zonesErr != nil {
return nil, zonesErr
}
zonesResult := zonesIterator.Response()
return &zonesResult, nil
zones = append(zones, nextResult.Value...)
}
return zones, nil
}
func (a *azurednsProvider) getZones() error {
a.zones = make(map[string]*adns.Zone)
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
zonesIterator, zonesErr := a.zonesClient.ListByResourceGroup(ctx, *a.resourceGroup, to.Int32Ptr(100))
if zonesErr != nil {
return fmt.Errorf("getZones: zonesErr: SubscriptionID=%q err=%w", a.zonesClient.BaseClient.SubscriptionID, zonesErr)
zones, err := a.getExistingZones()
if err != nil {
return err
}
// Check getExistingZones and https://github.com/StackExchange/dnscontrol/issues/792 for the details
for zonesIterator.NotDone() {
zonesResult := zonesIterator.Response()
for _, z := range *zonesResult.Value {
for _, z := range zones {
zone := z
domain := strings.TrimSuffix(*z.Name, ".")
a.zones[domain] = &zone
}
zonesIterator.NextWithContext(ctx)
a.zones[domain] = zone
}
return nil
@ -131,31 +126,26 @@ func (a *azurednsProvider) GetNameservers(domain string) ([]*models.Nameserver,
}
var nss []string
if zone.ZoneProperties != nil {
nss = append(nss, *zone.ZoneProperties.NameServers...)
if zone.Properties != nil {
for _, ns := range zone.Properties.NameServers {
nss = append(nss, *ns)
}
}
return models.ToNameserversStripTD(nss)
}
func (a *azurednsProvider) ListZones() ([]string, error) {
zonesResult, err := a.getExistingZones()
if err != nil {
return nil, err
}
var zones []string
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
zonesIterator, zonesErr := a.zonesClient.ListByResourceGroup(ctx, *a.resourceGroup, to.Int32Ptr(100))
if zonesErr != nil {
return nil, fmt.Errorf("ListZones: zonesErr: %w", zonesErr)
}
// Check getExistingZones and https://github.com/StackExchange/dnscontrol/issues/792 for the details
for zonesIterator.NotDone() {
zonesResult := zonesIterator.Response()
for _, z := range *zonesResult.Value {
for _, z := range zonesResult {
domain := strings.TrimSuffix(*z.Name, ".")
zones = append(zones, domain)
}
zonesIterator.NextWithContext(ctx)
}
return zones, nil
}
@ -233,7 +223,7 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
if len(recs) == 0 {
var rrset *adns.RecordSet
for _, r := range records {
if strings.TrimSuffix(*r.RecordSetProperties.Fqdn, ".") == k.NameFQDN {
if strings.TrimSuffix(*r.Properties.Fqdn, ".") == k.NameFQDN {
n1, err := nativeToRecordType(r.Type)
if err != nil {
return nil, err
@ -259,7 +249,7 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
if err != nil {
return err
}
_, err = a.recordsClient.Delete(ctx, *a.resourceGroup, zoneName, *rrset.Name, rt, "")
_, err = a.recordsClient.Delete(ctx, *a.resourceGroup, zoneName, *rrset.Name, rt, nil)
if err != nil {
return err
}
@ -277,7 +267,7 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
var recordName string
for _, r := range recs {
i := int64(r.TTL)
rrset.TTL = &i // TODO: make sure that ttls are consistent within a set
rrset.Properties.TTL = &i // TODO: make sure that ttls are consistent within a set
recordName = r.Name
}
@ -290,15 +280,15 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
if err != nil {
return nil, err
}
if strings.TrimSuffix(*r.RecordSetProperties.Fqdn, ".") == k.NameFQDN && (changedRecordType == adns.CNAME || existingRecordType == adns.CNAME) {
if existingRecordType == adns.A || existingRecordType == adns.AAAA || changedRecordType == adns.A || changedRecordType == adns.AAAA { //CNAME cannot coexist with an A or AA
if strings.TrimSuffix(*r.Properties.Fqdn, ".") == k.NameFQDN && (changedRecordType == adns.RecordTypeCNAME || existingRecordType == adns.RecordTypeCNAME) {
if existingRecordType == adns.RecordTypeA || existingRecordType == adns.RecordTypeAAAA || changedRecordType == adns.RecordTypeA || changedRecordType == adns.RecordTypeAAAA { //CNAME cannot coexist with an A or AA
corrections = append(corrections,
&models.Correction{
Msg: strings.Join(namesToUpdate[k], "\n"),
F: func() error {
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
_, err := a.recordsClient.Delete(ctx, *a.resourceGroup, zoneName, recordName, existingRecordType, "")
_, err := a.recordsClient.Delete(ctx, *a.resourceGroup, zoneName, recordName, existingRecordType, nil)
if err != nil {
return err
}
@ -315,7 +305,7 @@ func (a *azurednsProvider) GetDomainCorrections(dc *models.DomainConfig) ([]*mod
F: func() error {
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
_, err := a.recordsClient.CreateOrUpdate(ctx, *a.resourceGroup, zoneName, recordName, recordType, *rrset, "", "")
_, err := a.recordsClient.CreateOrUpdate(ctx, *a.resourceGroup, zoneName, recordName, recordType, *rrset, nil)
if err != nil {
return err
}
@ -343,28 +333,28 @@ func nativeToRecordType(recordType *string) (adns.RecordType, error) {
recordTypeStripped := strings.TrimPrefix(*recordType, "Microsoft.Network/dnszones/")
switch recordTypeStripped {
case "A", "AZURE_ALIAS_A":
return adns.A, nil
return adns.RecordTypeA, nil
case "AAAA", "AZURE_ALIAS_AAAA":
return adns.AAAA, nil
return adns.RecordTypeAAAA, nil
case "CAA":
return adns.CAA, nil
return adns.RecordTypeCAA, nil
case "CNAME", "AZURE_ALIAS_CNAME":
return adns.CNAME, nil
return adns.RecordTypeCNAME, nil
case "MX":
return adns.MX, nil
return adns.RecordTypeMX, nil
case "NS":
return adns.NS, nil
return adns.RecordTypeNS, nil
case "PTR":
return adns.PTR, nil
return adns.RecordTypePTR, nil
case "SRV":
return adns.SRV, nil
return adns.RecordTypeSRV, nil
case "TXT":
return adns.TXT, nil
return adns.RecordTypeTXT, nil
case "SOA":
return adns.SOA, nil
return adns.RecordTypeSOA, nil
default:
// Unimplemented type. Return adns.A as a decoy, but send an error.
return adns.A, fmt.Errorf("rc.String rtype %v unimplemented", *recordType)
return adns.RecordTypeA, fmt.Errorf("rc.String rtype %v unimplemented", *recordType)
}
}
@ -372,118 +362,122 @@ func nativeToRecords(set *adns.RecordSet, origin string) []*models.RecordConfig
var results []*models.RecordConfig
switch rtype := *set.Type; rtype {
case "Microsoft.Network/dnszones/A":
if set.ARecords != nil {
for _, rec := range *set.ARecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
if set.Properties.ARecords != nil {
for _, rec := range set.Properties.ARecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "A"
_ = rc.SetTarget(*rec.Ipv4Address)
_ = rc.SetTarget(*rec.IPv4Address)
results = append(results, rc)
}
} else {
rc := &models.RecordConfig{
Type: "AZURE_ALIAS",
TTL: uint32(*set.TTL),
TTL: uint32(*set.Properties.TTL),
AzureAlias: map[string]string{
"type": "A",
},
}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
_ = rc.SetTarget(*set.TargetResource.ID)
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
_ = rc.SetTarget(*set.Properties.TargetResource.ID)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/AAAA":
if set.AaaaRecords != nil {
for _, rec := range *set.AaaaRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
if set.Properties.AaaaRecords != nil {
for _, rec := range set.Properties.AaaaRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "AAAA"
_ = rc.SetTarget(*rec.Ipv6Address)
_ = rc.SetTarget(*rec.IPv6Address)
results = append(results, rc)
}
} else {
rc := &models.RecordConfig{
Type: "AZURE_ALIAS",
TTL: uint32(*set.TTL),
TTL: uint32(*set.Properties.TTL),
AzureAlias: map[string]string{
"type": "AAAA",
},
}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
_ = rc.SetTarget(*set.TargetResource.ID)
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
_ = rc.SetTarget(*set.Properties.TargetResource.ID)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/CNAME":
if set.CnameRecord != nil {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
if set.Properties.CnameRecord != nil {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "CNAME"
_ = rc.SetTarget(*set.CnameRecord.Cname)
_ = rc.SetTarget(*set.Properties.CnameRecord.Cname)
results = append(results, rc)
} else {
rc := &models.RecordConfig{
Type: "AZURE_ALIAS",
TTL: uint32(*set.TTL),
TTL: uint32(*set.Properties.TTL),
AzureAlias: map[string]string{
"type": "CNAME",
},
}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
_ = rc.SetTarget(*set.TargetResource.ID)
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
_ = rc.SetTarget(*set.Properties.TargetResource.ID)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/NS":
for _, rec := range *set.NsRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.NsRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "NS"
_ = rc.SetTarget(*rec.Nsdname)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/PTR":
for _, rec := range *set.PtrRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.PtrRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "PTR"
_ = rc.SetTarget(*rec.Ptrdname)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/TXT":
if len(*set.TxtRecords) == 0 { // Empty String Record Parsing
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
if len(set.Properties.TxtRecords) == 0 { // Empty String Record Parsing
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "TXT"
_ = rc.SetTargetTXT("")
results = append(results, rc)
} else {
for _, rec := range *set.TxtRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.TxtRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "TXT"
_ = rc.SetTargetTXTs(*rec.Value)
var txts []string
for _, txt := range rec.Value {
txts = append(txts, *txt)
}
_ = rc.SetTargetTXTs(txts)
results = append(results, rc)
}
}
case "Microsoft.Network/dnszones/MX":
for _, rec := range *set.MxRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.MxRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "MX"
_ = rc.SetTargetMX(uint16(*rec.Preference), *rec.Exchange)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/SRV":
for _, rec := range *set.SrvRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.SrvRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "SRV"
_ = rc.SetTargetSRV(uint16(*rec.Priority), uint16(*rec.Weight), uint16(*rec.Port), *rec.Target)
results = append(results, rc)
}
case "Microsoft.Network/dnszones/CAA":
for _, rec := range *set.CaaRecords {
rc := &models.RecordConfig{TTL: uint32(*set.TTL)}
rc.SetLabelFromFQDN(*set.Fqdn, origin)
for _, rec := range set.Properties.CaaRecords {
rc := &models.RecordConfig{TTL: uint32(*set.Properties.TTL)}
rc.SetLabelFromFQDN(*set.Properties.Fqdn, origin)
rc.Type = "CAA"
_ = rc.SetTargetCAA(uint8(*rec.Flags), *rec.Tag, *rec.Value)
results = append(results, rc)
@ -496,65 +490,69 @@ func nativeToRecords(set *adns.RecordSet, origin string) []*models.RecordConfig
}
func (a *azurednsProvider) recordToNative(recordKey models.RecordKey, recordConfig []*models.RecordConfig) (*adns.RecordSet, adns.RecordType, error) {
recordSet := &adns.RecordSet{Type: to.StringPtr(recordKey.Type), RecordSetProperties: &adns.RecordSetProperties{}}
recordSet := &adns.RecordSet{Type: to.StringPtr(recordKey.Type), Properties: &adns.RecordSetProperties{}}
for _, rec := range recordConfig {
switch recordKey.Type {
case "A":
if recordSet.ARecords == nil {
recordSet.ARecords = &[]adns.ARecord{}
if recordSet.Properties.ARecords == nil {
recordSet.Properties.ARecords = []*adns.ARecord{}
}
*recordSet.ARecords = append(*recordSet.ARecords, adns.ARecord{Ipv4Address: to.StringPtr(rec.GetTargetField())})
recordSet.Properties.ARecords = append(recordSet.Properties.ARecords, &adns.ARecord{IPv4Address: to.StringPtr(rec.GetTargetField())})
case "AAAA":
if recordSet.AaaaRecords == nil {
recordSet.AaaaRecords = &[]adns.AaaaRecord{}
if recordSet.Properties.AaaaRecords == nil {
recordSet.Properties.AaaaRecords = []*adns.AaaaRecord{}
}
*recordSet.AaaaRecords = append(*recordSet.AaaaRecords, adns.AaaaRecord{Ipv6Address: to.StringPtr(rec.GetTargetField())})
recordSet.Properties.AaaaRecords = append(recordSet.Properties.AaaaRecords, &adns.AaaaRecord{IPv6Address: to.StringPtr(rec.GetTargetField())})
case "CNAME":
recordSet.CnameRecord = &adns.CnameRecord{Cname: to.StringPtr(rec.GetTargetField())}
recordSet.Properties.CnameRecord = &adns.CnameRecord{Cname: to.StringPtr(rec.GetTargetField())}
case "NS":
if recordSet.NsRecords == nil {
recordSet.NsRecords = &[]adns.NsRecord{}
if recordSet.Properties.NsRecords == nil {
recordSet.Properties.NsRecords = []*adns.NsRecord{}
}
*recordSet.NsRecords = append(*recordSet.NsRecords, adns.NsRecord{Nsdname: to.StringPtr(rec.GetTargetField())})
recordSet.Properties.NsRecords = append(recordSet.Properties.NsRecords, &adns.NsRecord{Nsdname: to.StringPtr(rec.GetTargetField())})
case "PTR":
if recordSet.PtrRecords == nil {
recordSet.PtrRecords = &[]adns.PtrRecord{}
if recordSet.Properties.PtrRecords == nil {
recordSet.Properties.PtrRecords = []*adns.PtrRecord{}
}
*recordSet.PtrRecords = append(*recordSet.PtrRecords, adns.PtrRecord{Ptrdname: to.StringPtr(rec.GetTargetField())})
recordSet.Properties.PtrRecords = append(recordSet.Properties.PtrRecords, &adns.PtrRecord{Ptrdname: to.StringPtr(rec.GetTargetField())})
case "TXT":
if recordSet.TxtRecords == nil {
recordSet.TxtRecords = &[]adns.TxtRecord{}
if recordSet.Properties.TxtRecords == nil {
recordSet.Properties.TxtRecords = []*adns.TxtRecord{}
}
// Empty TXT record needs to have no value set in it's properties
if !(len(rec.TxtStrings) == 1 && rec.TxtStrings[0] == "") {
*recordSet.TxtRecords = append(*recordSet.TxtRecords, adns.TxtRecord{Value: &rec.TxtStrings})
var txts []*string
for _, txt := range rec.TxtStrings {
txts = append(txts, to.StringPtr(txt))
}
recordSet.Properties.TxtRecords = append(recordSet.Properties.TxtRecords, &adns.TxtRecord{Value: txts})
}
case "MX":
if recordSet.MxRecords == nil {
recordSet.MxRecords = &[]adns.MxRecord{}
if recordSet.Properties.MxRecords == nil {
recordSet.Properties.MxRecords = []*adns.MxRecord{}
}
*recordSet.MxRecords = append(*recordSet.MxRecords, adns.MxRecord{Exchange: to.StringPtr(rec.GetTargetField()), Preference: to.Int32Ptr(int32(rec.MxPreference))})
recordSet.Properties.MxRecords = append(recordSet.Properties.MxRecords, &adns.MxRecord{Exchange: to.StringPtr(rec.GetTargetField()), Preference: to.Int32Ptr(int32(rec.MxPreference))})
case "SRV":
if recordSet.SrvRecords == nil {
recordSet.SrvRecords = &[]adns.SrvRecord{}
if recordSet.Properties.SrvRecords == nil {
recordSet.Properties.SrvRecords = []*adns.SrvRecord{}
}
*recordSet.SrvRecords = append(*recordSet.SrvRecords, adns.SrvRecord{Target: to.StringPtr(rec.GetTargetField()), Port: to.Int32Ptr(int32(rec.SrvPort)), Weight: to.Int32Ptr(int32(rec.SrvWeight)), Priority: to.Int32Ptr(int32(rec.SrvPriority))})
recordSet.Properties.SrvRecords = append(recordSet.Properties.SrvRecords, &adns.SrvRecord{Target: to.StringPtr(rec.GetTargetField()), Port: to.Int32Ptr(int32(rec.SrvPort)), Weight: to.Int32Ptr(int32(rec.SrvWeight)), Priority: to.Int32Ptr(int32(rec.SrvPriority))})
case "CAA":
if recordSet.CaaRecords == nil {
recordSet.CaaRecords = &[]adns.CaaRecord{}
if recordSet.Properties.CaaRecords == nil {
recordSet.Properties.CaaRecords = []*adns.CaaRecord{}
}
*recordSet.CaaRecords = append(*recordSet.CaaRecords, adns.CaaRecord{Value: to.StringPtr(rec.GetTargetField()), Tag: to.StringPtr(rec.CaaTag), Flags: to.Int32Ptr(int32(rec.CaaFlag))})
recordSet.Properties.CaaRecords = append(recordSet.Properties.CaaRecords, &adns.CaaRecord{Value: to.StringPtr(rec.GetTargetField()), Tag: to.StringPtr(rec.CaaTag), Flags: to.Int32Ptr(int32(rec.CaaFlag))})
case "AZURE_ALIAS_A", "AZURE_ALIAS_AAAA", "AZURE_ALIAS_CNAME":
*recordSet.Type = rec.AzureAlias["type"]
recordSet.TargetResource = &adns.SubResource{ID: to.StringPtr(rec.GetTargetField())}
recordSet.Properties.TargetResource = &adns.SubResource{ID: to.StringPtr(rec.GetTargetField())}
default:
return nil, adns.A, fmt.Errorf("rc.String rtype %v unimplemented", recordKey.Type) // ands.A is a placeholder
return nil, adns.RecordTypeA, fmt.Errorf("rc.String rtype %v unimplemented", recordKey.Type) // ands.A is a placeholder
}
}
rt, err := nativeToRecordType(to.StringPtr(*recordSet.Type))
if err != nil {
return nil, adns.A, err // adns.A is a placeholder
return nil, adns.RecordTypeA, err // adns.A is a placeholder
}
return recordSet, rt, nil
}
@ -566,18 +564,14 @@ func (a *azurednsProvider) fetchRecordSets(zoneName string) ([]*adns.RecordSet,
var records []*adns.RecordSet
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
recordsIterator, recordsErr := a.recordsClient.ListAllByDNSZone(ctx, *a.resourceGroup, zoneName, to.Int32Ptr(1000), "")
recordsPager := a.recordsClient.NewListAllByDNSZonePager(*a.resourceGroup, zoneName, nil)
for recordsPager.More() {
nextResult, recordsErr := recordsPager.NextPage(ctx)
if recordsErr != nil {
return nil, recordsErr
}
for recordsIterator.NotDone() {
recordsResult := recordsIterator.Response()
for _, r := range *recordsResult.Value {
record := r
records = append(records, &record)
}
recordsIterator.NextWithContext(ctx)
records = append(records, nextResult.Value...)
}
return records, nil
@ -592,7 +586,7 @@ func (a *azurednsProvider) EnsureDomainExists(domain string) error {
ctx, cancel := context.WithTimeout(context.Background(), 6000*time.Second)
defer cancel()
_, err := a.zonesClient.CreateOrUpdate(ctx, *a.resourceGroup, domain, adns.Zone{Location: to.StringPtr("global")}, "", "")
_, err := a.zonesClient.CreateOrUpdate(ctx, *a.resourceGroup, domain, adns.Zone{Location: to.StringPtr("global")}, nil)
if err != nil {
return err
}