dependencies: updating Azure/azure-sdk-for-go, Azure/go-autorest, hashicorp/go-azure-helpers, tombuildsstuff/giovanni

* updating `github.com/Azure/azure-sdk-for-go` to `v45.0.0`
* updating `github.com/Azure/go-autorest` to `v0.11.3`
* updating `github.com/hashicorp/go-azure-helpers` to `v0.12.0`
* updating `github.com/tombuildsstuff/giovanni` to `v0.12.0`
This commit is contained in:
tombuildsstuff 2020-08-07 10:45:40 +02:00
parent 796eba95da
commit dc886f19c5
85 changed files with 3090 additions and 904 deletions

21
go.mod
View File

@ -2,8 +2,8 @@ module github.com/hashicorp/terraform
require (
cloud.google.com/go v0.45.1
github.com/Azure/azure-sdk-for-go v40.3.0+incompatible
github.com/Azure/go-autorest/autorest v0.10.0
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.3
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/ChrisTrenkamp/goxpath v0.0.0-20190607011252-c5096ec8773d // indirect
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af // indirect
@ -54,7 +54,7 @@ require (
github.com/hashicorp/aws-sdk-go-base v0.5.0
github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-azure-helpers v0.10.0
github.com/hashicorp/go-azure-helpers v0.12.0
github.com/hashicorp/go-checkpoint v0.5.0
github.com/hashicorp/go-cleanhttp v0.5.1
github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02
@ -121,7 +121,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go v3.0.82+incompatible
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect
github.com/tombuildsstuff/giovanni v0.10.1
github.com/tombuildsstuff/giovanni v0.12.0
github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5 // indirect
github.com/vmihailenco/msgpack v4.0.1+incompatible // indirect
github.com/xanzy/ssh-agent v0.2.1
@ -132,7 +132,7 @@ require (
go.uber.org/atomic v1.3.2 // indirect
go.uber.org/multierr v1.1.0 // indirect
go.uber.org/zap v1.9.1 // indirect
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/mod v0.2.0
golang.org/x/net v0.0.0-20200602114024-627f9648deb9
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
@ -148,15 +148,6 @@ require (
k8s.io/utils v0.0.0-20200411171748-3d5a2fe318e4
)
replace (
github.com/Azure/go-autorest v11.1.2+incompatible => github.com/Azure/go-autorest v12.1.0+incompatible
k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
)
replace k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
go 1.14
replace github.com/Azure/go-autorest => github.com/tombuildsstuff/go-autorest v14.0.1-0.20200416184303-d4e299a3c04a+incompatible
replace github.com/Azure/go-autorest/autorest => github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a
replace github.com/Azure/go-autorest/autorest/azure/auth => github.com/tombuildsstuff/go-autorest/autorest/azure/auth v0.4.3-0.20200416184303-d4e299a3c04a

77
go.sum
View File

@ -7,40 +7,29 @@ cloud.google.com/go v0.45.1 h1:lRi0CHyU+ytlvylOlFKKq0af6JncuyoRh1J+QJBqQx0=
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
github.com/Azure/azure-sdk-for-go v21.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v32.5.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v35.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/azure-sdk-for-go v40.3.0+incompatible h1:NthZg3psrLxvQLN6rVm07pZ9mv2wvGNaBNGQ3fnPvLE=
github.com/Azure/azure-sdk-for-go v40.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v12.1.0+incompatible h1:x0sVyfVo0Qw9jcgVHuKIAiTHGRvQ9PsJP+43TVPV/DM=
github.com/Azure/go-autorest v12.1.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.6.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/adal v0.8.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/adal v0.8.1-0.20191028180845-3492b2aff503 h1:Hxqlh1uAA8aGpa1dFhDNhll7U/rkWtG8ZItFvRMr7l0=
github.com/Azure/go-autorest/autorest/adal v0.8.1-0.20191028180845-3492b2aff503/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/adal v0.8.2 h1:O1X4oexUxnZCaEUGsvMnr8ZGj8HI37tNezwY4npRqA0=
github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
github.com/Azure/go-autorest/autorest/azure/cli v0.2.0 h1:pSwNMF0qotgehbQNllUWwJ4V3vnrLKOzHrwDLEZK904=
github.com/Azure/go-autorest/autorest/azure/cli v0.2.0/go.mod h1:WWTbGPvkAg3I4ms2j2s+Zr5xCGwGqTQh+6M2ZqOczkE=
github.com/Azure/go-autorest/autorest/azure/cli v0.3.0 h1:5PAqnv+CSTwW9mlZWZAizmzrazFWEgZykEZXpr2hDtY=
github.com/Azure/go-autorest/autorest/azure/cli v0.3.0/go.mod h1:rNYMNAefZMRowqCV0cVhr/YDW5dD7afFq9nXAXL4ykE=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/autorest/to v0.3.0 h1:zebkZaadz7+wIQYgC7GXaz3Wb28yKYfVkkBKwc38VF8=
github.com/Azure/go-autorest/autorest/to v0.3.0/go.mod h1:MgwOyqaIuKdG4TL/2ywSsIWKAfJfgHDo8ObuUk3t5sA=
github.com/Azure/go-autorest/autorest/validation v0.2.0 h1:15vMO4y76dehZSq7pAaOLQxC6dZYsSrj2GQpflyM/L4=
github.com/Azure/go-autorest/autorest/validation v0.2.0/go.mod h1:3EEqHnBxQGHXRYq3HT1WyXAvT7LLY3tl70hw6tQIbjI=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible h1:/bZYPaJLCqXeCqQqEeEIQg/p7RNafOhaVFhC6IWxZ/8=
github.com/Azure/azure-sdk-for-go v45.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
github.com/Azure/go-autorest v11.1.2+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
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.3 h1:fyYnmYujkIXUgv88D9/Wo2ybE4Zwd/TmQd5sSI5u2Ws=
github.com/Azure/go-autorest/autorest v0.11.3/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
github.com/Azure/go-autorest/autorest/adal v0.9.0 h1:SigMbuFNuKgc1xcGhaeapbh+8fgsu+GxgDRFyg7f5lM=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.0 h1:Ml+UCrnlKD+cJmSzrZ/RDcDw86NjkRUpnFh7V5JUhzU=
github.com/Azure/go-autorest/autorest/azure/cli v0.4.0/go.mod h1:JljT387FplPzBA31vUcvsetLKF3pec5bdAxjVU4kI2s=
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.0 h1:z20OWOSG5aCye0HEkDp6TPmP17ZcfeMxPi6HnSALa8c=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/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/autorest/validation v0.3.0 h1:3I9AAI63HfcLtphd9g39ruUwRI+Ca+z/f36KHPFRUss=
github.com/Azure/go-autorest/autorest/validation v0.3.0/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E=
github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE=
github.com/Azure/go-autorest/logger v0.2.0/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/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4 h1:pSm8mp0T2OH2CPmPDPtwHPr3VAQaOwVF/JbllOPP4xA=
github.com/Azure/go-ntlmssp v0.0.0-20180810175552-4a21cbd618b4/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28=
@ -137,7 +126,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/dgrijalva/jwt-go v0.0.0-20160705203006-01aeca54ebda/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dimchansky/utfbom v1.0.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4=
github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
@ -244,9 +232,8 @@ github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089 h1:1eDpXAxTh0iPv+
github.com/hashicorp/consul v0.0.0-20171026175957-610f3c86a089/go.mod h1:mFrjN1mfidgJfYP1xrJCF+AfRhr6Eaqhb2+sfyn/OOI=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-azure-helpers v0.4.1/go.mod h1:lu62V//auUow6k0IykxLK2DCNW8qTmpm8KqhYVWattA=
github.com/hashicorp/go-azure-helpers v0.10.0 h1:KhjDnQhCqEMKlt4yH00MCevJQPJ6LkHFdSveXINO6vE=
github.com/hashicorp/go-azure-helpers v0.10.0/go.mod h1:YuAtHxm2v74s+IjQwUG88dHBJPd5jL+cXr5BGVzSKhE=
github.com/hashicorp/go-azure-helpers v0.12.0 h1:7D0mFSyP3EfHu1ySubserIsnUWY87HMzzTWOB7ASwRU=
github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg=
github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU=
github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
@ -499,12 +486,8 @@ github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c h1:iRD1Cq
github.com/tencentyun/cos-go-sdk-v5 v0.0.0-20190808065407-f07404cefc8c/go.mod h1:wk2XFUg6egk4tSDNZtXeKfe2G6690UVyt163PuUxBZk=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/tombuildsstuff/giovanni v0.10.1 h1:AWfooo7kvVgfpjdp+NF/WDM5Pbkt4KMSv/h57t3DNRU=
github.com/tombuildsstuff/giovanni v0.10.1/go.mod h1:WwPhFP2+WnhJzvPYDnsyBab2wOIksMX6xm+Tg+jVvKw=
github.com/tombuildsstuff/go-autorest v14.0.1-0.20200416184303-d4e299a3c04a+incompatible h1:9645FYqYopS+TFknygW7EC9PCbIC5T4WvWUpktyE2JA=
github.com/tombuildsstuff/go-autorest v14.0.1-0.20200416184303-d4e299a3c04a+incompatible/go.mod h1:OVwh0+NZeL2RTqclVEX+p20Qys7Ihpd52PD0eqFDXtY=
github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a h1:F/4zKpn8ra3rhPMBzrVc7LYL1GB1ucl/va4I+4ubUWg=
github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a/go.mod h1:/FALq9T/kS7b5J5qsQ+RSTUdAmGFqi0vUdVNNx8q630=
github.com/tombuildsstuff/giovanni v0.12.0 h1:PZmiH+twM6C0/fN5Q6gaE2OUaKjh+ypVesjGMkHZgzE=
github.com/tombuildsstuff/giovanni v0.12.0/go.mod h1:qJ5dpiYWkRsuOSXO8wHbee7+wElkLNfWVolcf59N84E=
github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5 h1:cMjKdf4PxEBN9K5HaD9UMW8gkTbM0kMzkTa9SJe0WNQ=
github.com/ugorji/go v0.0.0-20180813092308-00b869d2f4a5/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/ulikunitz/xz v0.5.5 h1:pFrO0lVpTBXLpYw+pnLj6TbvHuyjXMfjGeCwSqCVwok=
@ -536,7 +519,6 @@ go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181025213731-e84da0312774/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190222235706-ffb98f73852f/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -544,9 +526,8 @@ golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=

View File

@ -119,7 +119,6 @@ func (client ApplicationsClient) AddOwnerSender(req *http.Request) (*http.Respon
func (client ApplicationsClient) AddOwnerResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -199,7 +198,6 @@ func (client ApplicationsClient) CreateSender(req *http.Request) (*http.Response
func (client ApplicationsClient) CreateResponder(resp *http.Response) (result Application, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -273,7 +271,6 @@ func (client ApplicationsClient) DeleteSender(req *http.Request) (*http.Response
func (client ApplicationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -346,7 +343,6 @@ func (client ApplicationsClient) GetSender(req *http.Request) (*http.Response, e
func (client ApplicationsClient) GetResponder(resp *http.Response) (result Application, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -420,7 +416,6 @@ func (client ApplicationsClient) GetServicePrincipalsIDByAppIDSender(req *http.R
func (client ApplicationsClient) GetServicePrincipalsIDByAppIDResponder(resp *http.Response) (result ServicePrincipalObjectResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -465,6 +460,9 @@ func (client ApplicationsClient) List(ctx context.Context, filter string) (resul
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "List", resp, "Failure responding to request")
}
if result.alr.hasNextLink() && result.alr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -502,7 +500,6 @@ func (client ApplicationsClient) ListSender(req *http.Request) (*http.Response,
func (client ApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -592,7 +589,6 @@ func (client ApplicationsClient) ListKeyCredentialsSender(req *http.Request) (*h
func (client ApplicationsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -666,7 +662,6 @@ func (client ApplicationsClient) ListNextSender(req *http.Request) (*http.Respon
func (client ApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -706,6 +701,9 @@ func (client ApplicationsClient) ListOwners(ctx context.Context, applicationObje
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.ApplicationsClient", "ListOwners", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -741,7 +739,6 @@ func (client ApplicationsClient) ListOwnersSender(req *http.Request) (*http.Resp
func (client ApplicationsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -852,7 +849,6 @@ func (client ApplicationsClient) ListPasswordCredentialsSender(req *http.Request
func (client ApplicationsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -929,7 +925,6 @@ func (client ApplicationsClient) PatchSender(req *http.Request) (*http.Response,
func (client ApplicationsClient) PatchResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -1004,7 +999,6 @@ func (client ApplicationsClient) RemoveOwnerSender(req *http.Request) (*http.Res
func (client ApplicationsClient) RemoveOwnerResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -1080,7 +1074,6 @@ func (client ApplicationsClient) UpdateKeyCredentialsSender(req *http.Request) (
func (client ApplicationsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -1156,7 +1149,6 @@ func (client ApplicationsClient) UpdatePasswordCredentialsSender(req *http.Reque
func (client ApplicationsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp

View File

@ -109,7 +109,6 @@ func (client DeletedApplicationsClient) HardDeleteSender(req *http.Request) (*ht
func (client DeletedApplicationsClient) HardDeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -153,6 +152,9 @@ func (client DeletedApplicationsClient) List(ctx context.Context, filter string)
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.DeletedApplicationsClient", "List", resp, "Failure responding to request")
}
if result.alr.hasNextLink() && result.alr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -190,7 +192,6 @@ func (client DeletedApplicationsClient) ListSender(req *http.Request) (*http.Res
func (client DeletedApplicationsClient) ListResponder(resp *http.Response) (result ApplicationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -280,7 +281,6 @@ func (client DeletedApplicationsClient) ListNextSender(req *http.Request) (*http
func (client DeletedApplicationsClient) ListNextResponder(resp *http.Response) (result ApplicationListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -354,7 +354,6 @@ func (client DeletedApplicationsClient) RestoreSender(req *http.Request) (*http.
func (client DeletedApplicationsClient) RestoreResponder(resp *http.Response) (result Application, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -107,7 +107,6 @@ func (client DomainsClient) GetSender(req *http.Request) (*http.Response, error)
func (client DomainsClient) GetResponder(resp *http.Response) (result Domain, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -183,7 +182,6 @@ func (client DomainsClient) ListSender(req *http.Request) (*http.Response, error
func (client DomainsClient) ListResponder(resp *http.Response) (result DomainListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -0,0 +1,86 @@
package graphrbac
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// ConsentType enumerates the values for consent type.
type ConsentType string
const (
// AllPrincipals ...
AllPrincipals ConsentType = "AllPrincipals"
// Principal ...
Principal ConsentType = "Principal"
)
// PossibleConsentTypeValues returns an array of possible values for the ConsentType const type.
func PossibleConsentTypeValues() []ConsentType {
return []ConsentType{AllPrincipals, Principal}
}
// GroupMembershipClaimTypes enumerates the values for group membership claim types.
type GroupMembershipClaimTypes string
const (
// All ...
All GroupMembershipClaimTypes = "All"
// None ...
None GroupMembershipClaimTypes = "None"
// SecurityGroup ...
SecurityGroup GroupMembershipClaimTypes = "SecurityGroup"
)
// PossibleGroupMembershipClaimTypesValues returns an array of possible values for the GroupMembershipClaimTypes const type.
func PossibleGroupMembershipClaimTypesValues() []GroupMembershipClaimTypes {
return []GroupMembershipClaimTypes{All, None, SecurityGroup}
}
// ObjectType enumerates the values for object type.
type ObjectType string
const (
// ObjectTypeApplication ...
ObjectTypeApplication ObjectType = "Application"
// ObjectTypeDirectoryObject ...
ObjectTypeDirectoryObject ObjectType = "DirectoryObject"
// ObjectTypeGroup ...
ObjectTypeGroup ObjectType = "Group"
// ObjectTypeServicePrincipal ...
ObjectTypeServicePrincipal ObjectType = "ServicePrincipal"
// ObjectTypeUser ...
ObjectTypeUser ObjectType = "User"
)
// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type.
func PossibleObjectTypeValues() []ObjectType {
return []ObjectType{ObjectTypeApplication, ObjectTypeDirectoryObject, ObjectTypeGroup, ObjectTypeServicePrincipal, ObjectTypeUser}
}
// UserType enumerates the values for user type.
type UserType string
const (
// Guest ...
Guest UserType = "Guest"
// Member ...
Member UserType = "Member"
)
// PossibleUserTypeValues returns an array of possible values for the UserType const type.
func PossibleUserTypeValues() []UserType {
return []UserType{Guest, Member}
}

View File

@ -119,7 +119,6 @@ func (client GroupsClient) AddMemberSender(req *http.Request) (*http.Response, e
func (client GroupsClient) AddMemberResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -202,7 +201,6 @@ func (client GroupsClient) AddOwnerSender(req *http.Request) (*http.Response, er
func (client GroupsClient) AddOwnerResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -285,7 +283,6 @@ func (client GroupsClient) CreateSender(req *http.Request) (*http.Response, erro
func (client GroupsClient) CreateResponder(resp *http.Response) (result ADGroup, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -359,7 +356,6 @@ func (client GroupsClient) DeleteSender(req *http.Request) (*http.Response, erro
func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -432,7 +428,6 @@ func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error)
func (client GroupsClient) GetResponder(resp *http.Response) (result ADGroup, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -477,6 +472,9 @@ func (client GroupsClient) GetGroupMembers(ctx context.Context, objectID string)
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "GetGroupMembers", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -512,7 +510,6 @@ func (client GroupsClient) GetGroupMembersSender(req *http.Request) (*http.Respo
func (client GroupsClient) GetGroupMembersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -602,7 +599,6 @@ func (client GroupsClient) GetGroupMembersNextSender(req *http.Request) (*http.R
func (client GroupsClient) GetGroupMembersNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -685,7 +681,6 @@ func (client GroupsClient) GetMemberGroupsSender(req *http.Request) (*http.Respo
func (client GroupsClient) GetMemberGroupsResponder(resp *http.Response) (result GroupGetMemberGroupsResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -768,7 +763,6 @@ func (client GroupsClient) IsMemberOfSender(req *http.Request) (*http.Response,
func (client GroupsClient) IsMemberOfResponder(resp *http.Response) (result CheckGroupMembershipResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -813,6 +807,9 @@ func (client GroupsClient) List(ctx context.Context, filter string) (result Grou
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "List", resp, "Failure responding to request")
}
if result.glr.hasNextLink() && result.glr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -850,7 +847,6 @@ func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error)
func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -940,7 +936,6 @@ func (client GroupsClient) ListNextSender(req *http.Request) (*http.Response, er
func (client GroupsClient) ListNextResponder(resp *http.Response) (result GroupListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -980,6 +975,9 @@ func (client GroupsClient) ListOwners(ctx context.Context, objectID string) (res
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.GroupsClient", "ListOwners", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -1015,7 +1013,6 @@ func (client GroupsClient) ListOwnersSender(req *http.Request) (*http.Response,
func (client GroupsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -1128,7 +1125,6 @@ func (client GroupsClient) RemoveMemberSender(req *http.Request) (*http.Response
func (client GroupsClient) RemoveMemberResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -1203,7 +1199,6 @@ func (client GroupsClient) RemoveOwnerSender(req *http.Request) (*http.Response,
func (client GroupsClient) RemoveOwnerResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp

View File

@ -30,74 +30,6 @@ import (
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
// ConsentType enumerates the values for consent type.
type ConsentType string
const (
// AllPrincipals ...
AllPrincipals ConsentType = "AllPrincipals"
// Principal ...
Principal ConsentType = "Principal"
)
// PossibleConsentTypeValues returns an array of possible values for the ConsentType const type.
func PossibleConsentTypeValues() []ConsentType {
return []ConsentType{AllPrincipals, Principal}
}
// GroupMembershipClaimTypes enumerates the values for group membership claim types.
type GroupMembershipClaimTypes string
const (
// All ...
All GroupMembershipClaimTypes = "All"
// None ...
None GroupMembershipClaimTypes = "None"
// SecurityGroup ...
SecurityGroup GroupMembershipClaimTypes = "SecurityGroup"
)
// PossibleGroupMembershipClaimTypesValues returns an array of possible values for the GroupMembershipClaimTypes const type.
func PossibleGroupMembershipClaimTypesValues() []GroupMembershipClaimTypes {
return []GroupMembershipClaimTypes{All, None, SecurityGroup}
}
// ObjectType enumerates the values for object type.
type ObjectType string
const (
// ObjectTypeApplication ...
ObjectTypeApplication ObjectType = "Application"
// ObjectTypeDirectoryObject ...
ObjectTypeDirectoryObject ObjectType = "DirectoryObject"
// ObjectTypeGroup ...
ObjectTypeGroup ObjectType = "Group"
// ObjectTypeServicePrincipal ...
ObjectTypeServicePrincipal ObjectType = "ServicePrincipal"
// ObjectTypeUser ...
ObjectTypeUser ObjectType = "User"
)
// PossibleObjectTypeValues returns an array of possible values for the ObjectType const type.
func PossibleObjectTypeValues() []ObjectType {
return []ObjectType{ObjectTypeApplication, ObjectTypeDirectoryObject, ObjectTypeGroup, ObjectTypeServicePrincipal, ObjectTypeUser}
}
// UserType enumerates the values for user type.
type UserType string
const (
// Guest ...
Guest UserType = "Guest"
// Member ...
Member UserType = "Member"
)
// PossibleUserTypeValues returns an array of possible values for the UserType const type.
func PossibleUserTypeValues() []UserType {
return []UserType{Guest, Member}
}
// AddOwnerParameters request parameters for adding a owner to an application.
type AddOwnerParameters struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
@ -1094,6 +1026,11 @@ func (alr ApplicationListResult) IsEmpty() bool {
return alr.Value == nil || len(*alr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (alr ApplicationListResult) hasNextLink() bool {
return alr.OdataNextLink != nil && len(*alr.OdataNextLink) != 0
}
// ApplicationListResultPage contains a page of Application values.
type ApplicationListResultPage struct {
fn func(context.Context, ApplicationListResult) (ApplicationListResult, error)
@ -1113,11 +1050,16 @@ func (page *ApplicationListResultPage) NextWithContext(ctx context.Context) (err
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.alr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.alr)
if err != nil {
return err
}
page.alr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.alr = next
return nil
}
@ -1635,10 +1577,15 @@ func (dolr DirectoryObjectListResult) IsEmpty() bool {
return dolr.Value == nil || len(*dolr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (dolr DirectoryObjectListResult) hasNextLink() bool {
return dolr.OdataNextLink != nil && len(*dolr.OdataNextLink) != 0
}
// directoryObjectListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dolr DirectoryObjectListResult) directoryObjectListResultPreparer(ctx context.Context) (*http.Request, error) {
if dolr.OdataNextLink == nil || len(to.String(dolr.OdataNextLink)) < 1 {
if !dolr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -1666,11 +1613,16 @@ func (page *DirectoryObjectListResultPage) NextWithContext(ctx context.Context)
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.dolr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.dolr)
if err != nil {
return err
}
page.dolr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.dolr = next
return nil
}
@ -2224,6 +2176,11 @@ func (glr GroupListResult) IsEmpty() bool {
return glr.Value == nil || len(*glr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (glr GroupListResult) hasNextLink() bool {
return glr.OdataNextLink != nil && len(*glr.OdataNextLink) != 0
}
// GroupListResultPage contains a page of ADGroup values.
type GroupListResultPage struct {
fn func(context.Context, GroupListResult) (GroupListResult, error)
@ -2243,11 +2200,16 @@ func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.glr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.glr)
if err != nil {
return err
}
page.glr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.glr = next
return nil
}
@ -2281,8 +2243,8 @@ func NewGroupListResultPage(getNextPage func(context.Context, GroupListResult) (
return GroupListResultPage{fn: getNextPage}
}
// InformationalURL represents a group of URIs that provide terms of service, marketing, support and
// privacy policy information about an application. The default value for each string is null.
// InformationalURL represents a group of URIs that provide terms of service, marketing, support and privacy
// policy information about an application. The default value for each string is null.
type InformationalURL struct {
// TermsOfService - The terms of service URI
TermsOfService *string `json:"termsOfService,omitempty"`
@ -2448,8 +2410,8 @@ type KeyCredentialsUpdateParameters struct {
}
// OAuth2Permission represents an OAuth 2.0 delegated permission scope. The specified OAuth 2.0 delegated
// permission scopes may be requested by client applications (through the requiredResourceAccess collection
// on the Application object) when calling a resource application. The oauth2Permissions property of the
// permission scopes may be requested by client applications (through the requiredResourceAccess collection on
// the Application object) when calling a resource application. The oauth2Permissions property of the
// ServicePrincipal entity and of the Application entity is a collection of OAuth2Permission.
type OAuth2Permission struct {
// AdminConsentDescription - Permission help text that appears in the admin consent and app assignment experiences.
@ -2571,6 +2533,11 @@ func (oa2pglr OAuth2PermissionGrantListResult) IsEmpty() bool {
return oa2pglr.Value == nil || len(*oa2pglr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (oa2pglr OAuth2PermissionGrantListResult) hasNextLink() bool {
return oa2pglr.OdataNextLink != nil && len(*oa2pglr.OdataNextLink) != 0
}
// OAuth2PermissionGrantListResultPage contains a page of OAuth2PermissionGrant values.
type OAuth2PermissionGrantListResultPage struct {
fn func(context.Context, OAuth2PermissionGrantListResult) (OAuth2PermissionGrantListResult, error)
@ -2590,11 +2557,16 @@ func (page *OAuth2PermissionGrantListResultPage) NextWithContext(ctx context.Con
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.oa2pglr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.oa2pglr)
if err != nil {
return err
}
page.oa2pglr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.oa2pglr = next
return nil
}
@ -2907,8 +2879,8 @@ type PreAuthorizedApplication struct {
Extensions *[]PreAuthorizedApplicationExtension `json:"extensions,omitempty"`
}
// PreAuthorizedApplicationExtension representation of an app PreAuthorizedApplicationExtension required by
// a pre authorized client app.
// PreAuthorizedApplicationExtension representation of an app PreAuthorizedApplicationExtension required by a
// pre authorized client app.
type PreAuthorizedApplicationExtension struct {
// Conditions - The extension's conditions.
Conditions *[]string `json:"conditions,omitempty"`
@ -2922,11 +2894,10 @@ type PreAuthorizedApplicationPermission struct {
AccessGrants *[]string `json:"accessGrants,omitempty"`
}
// RequiredResourceAccess specifies the set of OAuth 2.0 permission scopes and app roles under the
// specified resource that an application requires access to. The specified OAuth 2.0 permission scopes may
// be requested by client applications (through the requiredResourceAccess collection) when calling a
// resource application. The requiredResourceAccess property of the Application entity is a collection of
// RequiredResourceAccess.
// RequiredResourceAccess specifies the set of OAuth 2.0 permission scopes and app roles under the specified
// resource that an application requires access to. The specified OAuth 2.0 permission scopes may be requested
// by client applications (through the requiredResourceAccess collection) when calling a resource application.
// The requiredResourceAccess property of the Application entity is a collection of RequiredResourceAccess.
type RequiredResourceAccess struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
@ -3462,8 +3433,7 @@ func (sp *ServicePrincipal) UnmarshalJSON(body []byte) error {
return nil
}
// ServicePrincipalBase active Directory service principal common properties shared among GET, POST and
// PATCH
// ServicePrincipalBase active Directory service principal common properties shared among GET, POST and PATCH
type ServicePrincipalBase struct {
// AccountEnabled - whether or not the service principal account is enabled
AccountEnabled *bool `json:"accountEnabled,omitempty"`
@ -3574,6 +3544,11 @@ func (splr ServicePrincipalListResult) IsEmpty() bool {
return splr.Value == nil || len(*splr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (splr ServicePrincipalListResult) hasNextLink() bool {
return splr.OdataNextLink != nil && len(*splr.OdataNextLink) != 0
}
// ServicePrincipalListResultPage contains a page of ServicePrincipal values.
type ServicePrincipalListResultPage struct {
fn func(context.Context, ServicePrincipalListResult) (ServicePrincipalListResult, error)
@ -3593,11 +3568,16 @@ func (page *ServicePrincipalListResultPage) NextWithContext(ctx context.Context)
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.splr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.splr)
if err != nil {
return err
}
page.splr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.splr = next
return nil
}
@ -3656,8 +3636,8 @@ type ServicePrincipalUpdateParameters struct {
Tags *[]string `json:"tags,omitempty"`
}
// SignInName contains information about a sign-in name of a local account user in an Azure Active
// Directory B2C tenant.
// SignInName contains information about a sign-in name of a local account user in an Azure Active Directory
// B2C tenant.
type SignInName struct {
// AdditionalProperties - Unmatched properties from the message are deserialized this collection
AdditionalProperties map[string]interface{} `json:""`
@ -4439,6 +4419,11 @@ func (ulr UserListResult) IsEmpty() bool {
return ulr.Value == nil || len(*ulr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (ulr UserListResult) hasNextLink() bool {
return ulr.OdataNextLink != nil && len(*ulr.OdataNextLink) != 0
}
// UserListResultPage contains a page of User values.
type UserListResultPage struct {
fn func(context.Context, UserListResult) (UserListResult, error)
@ -4458,11 +4443,16 @@ func (page *UserListResultPage) NextWithContext(ctx context.Context) (err error)
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.ulr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.ulr)
if err != nil {
return err
}
page.ulr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.ulr = next
return nil
}

View File

@ -113,7 +113,6 @@ func (client OAuth2PermissionGrantClient) CreateSender(req *http.Request) (*http
func (client OAuth2PermissionGrantClient) CreateResponder(resp *http.Response) (result OAuth2PermissionGrant, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -187,7 +186,6 @@ func (client OAuth2PermissionGrantClient) DeleteSender(req *http.Request) (*http
func (client OAuth2PermissionGrantClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -231,6 +229,9 @@ func (client OAuth2PermissionGrantClient) List(ctx context.Context, filter strin
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.OAuth2PermissionGrantClient", "List", resp, "Failure responding to request")
}
if result.oa2pglr.hasNextLink() && result.oa2pglr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -268,7 +269,6 @@ func (client OAuth2PermissionGrantClient) ListSender(req *http.Request) (*http.R
func (client OAuth2PermissionGrantClient) ListResponder(resp *http.Response) (result OAuth2PermissionGrantListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -358,7 +358,6 @@ func (client OAuth2PermissionGrantClient) ListNextSender(req *http.Request) (*ht
func (client OAuth2PermissionGrantClient) ListNextResponder(resp *http.Response) (result OAuth2PermissionGrantListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -80,6 +80,9 @@ func (client ObjectsClient) GetObjectsByObjectIds(ctx context.Context, parameter
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.ObjectsClient", "GetObjectsByObjectIds", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -116,7 +119,6 @@ func (client ObjectsClient) GetObjectsByObjectIdsSender(req *http.Request) (*htt
func (client ObjectsClient) GetObjectsByObjectIdsResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -206,7 +208,6 @@ func (client ObjectsClient) GetObjectsByObjectIdsNextSender(req *http.Request) (
func (client ObjectsClient) GetObjectsByObjectIdsNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -117,7 +117,6 @@ func (client ServicePrincipalsClient) CreateSender(req *http.Request) (*http.Res
func (client ServicePrincipalsClient) CreateResponder(resp *http.Response) (result ServicePrincipal, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -191,7 +190,6 @@ func (client ServicePrincipalsClient) DeleteSender(req *http.Request) (*http.Res
func (client ServicePrincipalsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -264,7 +262,6 @@ func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Respon
func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -309,6 +306,9 @@ func (client ServicePrincipalsClient) List(ctx context.Context, filter string) (
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "List", resp, "Failure responding to request")
}
if result.splr.hasNextLink() && result.splr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -346,7 +346,6 @@ func (client ServicePrincipalsClient) ListSender(req *http.Request) (*http.Respo
func (client ServicePrincipalsClient) ListResponder(resp *http.Response) (result ServicePrincipalListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -436,7 +435,6 @@ func (client ServicePrincipalsClient) ListKeyCredentialsSender(req *http.Request
func (client ServicePrincipalsClient) ListKeyCredentialsResponder(resp *http.Response) (result KeyCredentialListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -510,7 +508,6 @@ func (client ServicePrincipalsClient) ListNextSender(req *http.Request) (*http.R
func (client ServicePrincipalsClient) ListNextResponder(resp *http.Response) (result ServicePrincipalListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -550,6 +547,9 @@ func (client ServicePrincipalsClient) ListOwners(ctx context.Context, objectID s
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.ServicePrincipalsClient", "ListOwners", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -585,7 +585,6 @@ func (client ServicePrincipalsClient) ListOwnersSender(req *http.Request) (*http
func (client ServicePrincipalsClient) ListOwnersResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -696,7 +695,6 @@ func (client ServicePrincipalsClient) ListPasswordCredentialsSender(req *http.Re
func (client ServicePrincipalsClient) ListPasswordCredentialsResponder(resp *http.Response) (result PasswordCredentialListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -773,7 +771,6 @@ func (client ServicePrincipalsClient) UpdateSender(req *http.Request) (*http.Res
func (client ServicePrincipalsClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -849,7 +846,6 @@ func (client ServicePrincipalsClient) UpdateKeyCredentialsSender(req *http.Reque
func (client ServicePrincipalsClient) UpdateKeyCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -925,7 +921,6 @@ func (client ServicePrincipalsClient) UpdatePasswordCredentialsSender(req *http.
func (client ServicePrincipalsClient) UpdatePasswordCredentialsResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp

View File

@ -105,7 +105,6 @@ func (client SignedInUserClient) GetSender(req *http.Request) (*http.Response, e
func (client SignedInUserClient) GetResponder(resp *http.Response) (result User, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -148,6 +147,9 @@ func (client SignedInUserClient) ListOwnedObjects(ctx context.Context) (result D
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.SignedInUserClient", "ListOwnedObjects", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -182,7 +184,6 @@ func (client SignedInUserClient) ListOwnedObjectsSender(req *http.Request) (*htt
func (client SignedInUserClient) ListOwnedObjectsResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -272,7 +273,6 @@ func (client SignedInUserClient) ListOwnedObjectsNextSender(req *http.Request) (
func (client SignedInUserClient) ListOwnedObjectsNextResponder(resp *http.Response) (result DirectoryObjectListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -121,7 +121,6 @@ func (client UsersClient) CreateSender(req *http.Request) (*http.Response, error
func (client UsersClient) CreateResponder(resp *http.Response) (result User, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -195,7 +194,6 @@ func (client UsersClient) DeleteSender(req *http.Request) (*http.Response, error
func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -268,7 +266,6 @@ func (client UsersClient) GetSender(req *http.Request) (*http.Response, error) {
func (client UsersClient) GetResponder(resp *http.Response) (result User, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -351,7 +348,6 @@ func (client UsersClient) GetMemberGroupsSender(req *http.Request) (*http.Respon
func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result UserGetMemberGroupsResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -362,7 +358,8 @@ func (client UsersClient) GetMemberGroupsResponder(resp *http.Response) (result
// List gets list of users for the current tenant.
// Parameters:
// filter - the filter to apply to the operation.
func (client UsersClient) List(ctx context.Context, filter string) (result UserListResultPage, err error) {
// expand - the expand value for the operation result.
func (client UsersClient) List(ctx context.Context, filter string, expand string) (result UserListResultPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List")
defer func() {
@ -379,7 +376,7 @@ func (client UsersClient) List(ctx context.Context, filter string) (result UserL
}
return client.ListNext(ctx, *lastResult.OdataNextLink)
}
req, err := client.ListPreparer(ctx, filter)
req, err := client.ListPreparer(ctx, filter, expand)
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", nil, "Failure preparing request")
return
@ -396,12 +393,15 @@ func (client UsersClient) List(ctx context.Context, filter string) (result UserL
if err != nil {
err = autorest.NewErrorWithError(err, "graphrbac.UsersClient", "List", resp, "Failure responding to request")
}
if result.ulr.hasNextLink() && result.ulr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
// ListPreparer prepares the List request.
func (client UsersClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) {
func (client UsersClient) ListPreparer(ctx context.Context, filter string, expand string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"tenantID": autorest.Encode("path", client.TenantID),
}
@ -413,6 +413,9 @@ func (client UsersClient) ListPreparer(ctx context.Context, filter string) (*htt
if len(filter) > 0 {
queryParameters["$filter"] = autorest.Encode("query", filter)
}
if len(expand) > 0 {
queryParameters["$expand"] = autorest.Encode("query", expand)
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
@ -433,7 +436,6 @@ func (client UsersClient) ListSender(req *http.Request) (*http.Response, error)
func (client UsersClient) ListResponder(resp *http.Response) (result UserListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -442,7 +444,7 @@ func (client UsersClient) ListResponder(resp *http.Response) (result UserListRes
}
// ListComplete enumerates all values, automatically crossing page boundaries as required.
func (client UsersClient) ListComplete(ctx context.Context, filter string) (result UserListResultIterator, err error) {
func (client UsersClient) ListComplete(ctx context.Context, filter string, expand string) (result UserListResultIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.List")
defer func() {
@ -453,7 +455,7 @@ func (client UsersClient) ListComplete(ctx context.Context, filter string) (resu
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.List(ctx, filter)
result.page, err = client.List(ctx, filter, expand)
return
}
@ -523,7 +525,6 @@ func (client UsersClient) ListNextSender(req *http.Request) (*http.Response, err
func (client UsersClient) ListNextResponder(resp *http.Response) (result UserListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -600,7 +601,6 @@ func (client UsersClient) UpdateSender(req *http.Request) (*http.Response, error
func (client UsersClient) UpdateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp

View File

@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version"
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/" + version.Number + " graphrbac/1.6"
return "Azure-SDK-For-Go/" + Version() + " graphrbac/1.6"
}
// Version returns the semantic version (see http://semver.org) of the client.

View File

@ -121,7 +121,6 @@ func (client DeploymentOperationsClient) GetSender(req *http.Request) (*http.Res
func (client DeploymentOperationsClient) GetResponder(resp *http.Response) (result DeploymentOperation, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -171,6 +170,9 @@ func (client DeploymentOperationsClient) List(ctx context.Context, resourceGroup
if err != nil {
err = autorest.NewErrorWithError(err, "resources.DeploymentOperationsClient", "List", resp, "Failure responding to request")
}
if result.dolr.hasNextLink() && result.dolr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -210,7 +212,6 @@ func (client DeploymentOperationsClient) ListSender(req *http.Request) (*http.Re
func (client DeploymentOperationsClient) ListResponder(resp *http.Response) (result DeploymentOperationsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -105,7 +105,6 @@ func (client DeploymentsClient) CalculateTemplateHashSender(req *http.Request) (
func (client DeploymentsClient) CalculateTemplateHashResponder(resp *http.Response) (result TemplateHashResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -189,7 +188,6 @@ func (client DeploymentsClient) CancelSender(req *http.Request) (*http.Response,
func (client DeploymentsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -272,7 +270,6 @@ func (client DeploymentsClient) CheckExistenceSender(req *http.Request) (*http.R
func (client DeploymentsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
autorest.ByClosing())
result.Response = resp
@ -365,7 +362,6 @@ func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future
func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentExtended, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -449,7 +445,6 @@ func (client DeploymentsClient) DeleteSender(req *http.Request) (future Deployme
func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -532,7 +527,6 @@ func (client DeploymentsClient) ExportTemplateSender(req *http.Request) (*http.R
func (client DeploymentsClient) ExportTemplateResponder(resp *http.Response) (result DeploymentExportResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -616,7 +610,6 @@ func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, er
func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentExtended, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -666,6 +659,9 @@ func (client DeploymentsClient) List(ctx context.Context, resourceGroupName stri
if err != nil {
err = autorest.NewErrorWithError(err, "resources.DeploymentsClient", "List", resp, "Failure responding to request")
}
if result.dlr.hasNextLink() && result.dlr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -707,7 +703,6 @@ func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, e
func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -838,7 +833,6 @@ func (client DeploymentsClient) ValidateSender(req *http.Request) (*http.Respons
func (client DeploymentsClient) ValidateResponder(resp *http.Response) (result DeploymentValidateResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusBadRequest),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -0,0 +1,46 @@
package resources
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// DeploymentMode enumerates the values for deployment mode.
type DeploymentMode string
const (
// Complete ...
Complete DeploymentMode = "Complete"
// Incremental ...
Incremental DeploymentMode = "Incremental"
)
// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type.
func PossibleDeploymentModeValues() []DeploymentMode {
return []DeploymentMode{Complete, Incremental}
}
// ResourceIdentityType enumerates the values for resource identity type.
type ResourceIdentityType string
const (
// SystemAssigned ...
SystemAssigned ResourceIdentityType = "SystemAssigned"
)
// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type.
func PossibleResourceIdentityTypeValues() []ResourceIdentityType {
return []ResourceIdentityType{SystemAssigned}
}

View File

@ -116,7 +116,6 @@ func (client GroupsClient) CheckExistenceSender(req *http.Request) (*http.Respon
func (client GroupsClient) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
autorest.ByClosing())
result.Response = resp
@ -203,7 +202,6 @@ func (client GroupsClient) CreateOrUpdateSender(req *http.Request) (*http.Respon
func (client GroupsClient) CreateOrUpdateResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -285,7 +283,6 @@ func (client GroupsClient) DeleteSender(req *http.Request) (future GroupsDeleteF
func (client GroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
@ -369,7 +366,6 @@ func (client GroupsClient) ExportTemplateSender(req *http.Request) (*http.Respon
func (client GroupsClient) ExportTemplateResponder(resp *http.Response) (result GroupExportResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -451,7 +447,6 @@ func (client GroupsClient) GetSender(req *http.Request) (*http.Response, error)
func (client GroupsClient) GetResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -492,6 +487,9 @@ func (client GroupsClient) List(ctx context.Context, filter string, top *int32)
if err != nil {
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "List", resp, "Failure responding to request")
}
if result.glr.hasNextLink() && result.glr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -532,7 +530,6 @@ func (client GroupsClient) ListSender(req *http.Request) (*http.Response, error)
func (client GroupsClient) ListResponder(resp *http.Response) (result GroupListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -621,6 +618,9 @@ func (client GroupsClient) ListResources(ctx context.Context, resourceGroupName
if err != nil {
err = autorest.NewErrorWithError(err, "resources.GroupsClient", "ListResources", resp, "Failure responding to request")
}
if result.lr.hasNextLink() && result.lr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -665,7 +665,6 @@ func (client GroupsClient) ListResourcesSender(req *http.Request) (*http.Respons
func (client GroupsClient) ListResourcesResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -790,7 +789,6 @@ func (client GroupsClient) PatchSender(req *http.Request) (*http.Response, error
func (client GroupsClient) PatchResponder(resp *http.Response) (result Group, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -31,34 +31,6 @@ import (
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-02-01/resources"
// DeploymentMode enumerates the values for deployment mode.
type DeploymentMode string
const (
// Complete ...
Complete DeploymentMode = "Complete"
// Incremental ...
Incremental DeploymentMode = "Incremental"
)
// PossibleDeploymentModeValues returns an array of possible values for the DeploymentMode const type.
func PossibleDeploymentModeValues() []DeploymentMode {
return []DeploymentMode{Complete, Incremental}
}
// ResourceIdentityType enumerates the values for resource identity type.
type ResourceIdentityType string
const (
// SystemAssigned ...
SystemAssigned ResourceIdentityType = "SystemAssigned"
)
// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type.
func PossibleResourceIdentityTypeValues() []ResourceIdentityType {
return []ResourceIdentityType{SystemAssigned}
}
// AliasPathType ...
type AliasPathType struct {
// Path - The path of an alias.
@ -132,6 +104,18 @@ type DeploymentExtended struct {
Properties *DeploymentPropertiesExtended `json:"properties,omitempty"`
}
// MarshalJSON is the custom marshaler for DeploymentExtended.
func (de DeploymentExtended) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if de.Name != nil {
objectMap["name"] = de.Name
}
if de.Properties != nil {
objectMap["properties"] = de.Properties
}
return json.Marshal(objectMap)
}
// DeploymentExtendedFilter deployment filter.
type DeploymentExtendedFilter struct {
// ProvisioningState - The provisioning state.
@ -215,10 +199,15 @@ func (dlr DeploymentListResult) IsEmpty() bool {
return dlr.Value == nil || len(*dlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (dlr DeploymentListResult) hasNextLink() bool {
return dlr.NextLink != nil && len(*dlr.NextLink) != 0
}
// deploymentListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dlr DeploymentListResult) deploymentListResultPreparer(ctx context.Context) (*http.Request, error) {
if dlr.NextLink == nil || len(to.String(dlr.NextLink)) < 1 {
if !dlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -246,11 +235,16 @@ func (page *DeploymentListResultPage) NextWithContext(ctx context.Context) (err
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.dlr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.dlr)
if err != nil {
return err
}
page.dlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.dlr = next
return nil
}
@ -324,8 +318,7 @@ type DeploymentOperationsListResult struct {
NextLink *string `json:"nextLink,omitempty"`
}
// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation
// values.
// DeploymentOperationsListResultIterator provides access to a complete listing of DeploymentOperation values.
type DeploymentOperationsListResultIterator struct {
i int
page DeploymentOperationsListResultPage
@ -393,10 +386,15 @@ func (dolr DeploymentOperationsListResult) IsEmpty() bool {
return dolr.Value == nil || len(*dolr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (dolr DeploymentOperationsListResult) hasNextLink() bool {
return dolr.NextLink != nil && len(*dolr.NextLink) != 0
}
// deploymentOperationsListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (dolr DeploymentOperationsListResult) deploymentOperationsListResultPreparer(ctx context.Context) (*http.Request, error) {
if dolr.NextLink == nil || len(to.String(dolr.NextLink)) < 1 {
if !dolr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -424,11 +422,16 @@ func (page *DeploymentOperationsListResultPage) NextWithContext(ctx context.Cont
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.dolr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.dolr)
if err != nil {
return err
}
page.dolr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.dolr = next
return nil
}
@ -506,8 +509,8 @@ type DeploymentPropertiesExtended struct {
DebugSetting *DebugSetting `json:"debugSetting,omitempty"`
}
// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
// DeploymentsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type DeploymentsCreateOrUpdateFuture struct {
azure.Future
}
@ -852,10 +855,15 @@ func (glr GroupListResult) IsEmpty() bool {
return glr.Value == nil || len(*glr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (glr GroupListResult) hasNextLink() bool {
return glr.NextLink != nil && len(*glr.NextLink) != 0
}
// groupListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (glr GroupListResult) groupListResultPreparer(ctx context.Context) (*http.Request, error) {
if glr.NextLink == nil || len(to.String(glr.NextLink)) < 1 {
if !glr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -883,11 +891,16 @@ func (page *GroupListResultPage) NextWithContext(ctx context.Context) (err error
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.glr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.glr)
if err != nil {
return err
}
page.glr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.glr = next
return nil
}
@ -965,6 +978,15 @@ type Identity struct {
Type ResourceIdentityType `json:"type,omitempty"`
}
// MarshalJSON is the custom marshaler for Identity.
func (i Identity) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if i.Type != "" {
objectMap["type"] = i.Type
}
return json.Marshal(objectMap)
}
// ListResult list of resource groups.
type ListResult struct {
autorest.Response `json:"-"`
@ -1042,10 +1064,15 @@ func (lr ListResult) IsEmpty() bool {
return lr.Value == nil || len(*lr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (lr ListResult) hasNextLink() bool {
return lr.NextLink != nil && len(*lr.NextLink) != 0
}
// listResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (lr ListResult) listResultPreparer(ctx context.Context) (*http.Request, error) {
if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 {
if !lr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -1073,11 +1100,16 @@ func (page *ListResultPage) NextWithContext(ctx context.Context) (err error) {
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.lr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.lr)
if err != nil {
return err
}
page.lr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.lr = next
return nil
}
@ -1131,8 +1163,7 @@ type MoveInfo struct {
TargetResourceGroup *string `json:"targetResourceGroup,omitempty"`
}
// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
// MoveResourcesFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type MoveResourcesFuture struct {
azure.Future
}
@ -1264,10 +1295,15 @@ func (plr ProviderListResult) IsEmpty() bool {
return plr.Value == nil || len(*plr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (plr ProviderListResult) hasNextLink() bool {
return plr.NextLink != nil && len(*plr.NextLink) != 0
}
// providerListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (plr ProviderListResult) providerListResultPreparer(ctx context.Context) (*http.Request, error) {
if plr.NextLink == nil || len(to.String(plr.NextLink)) < 1 {
if !plr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -1295,11 +1331,16 @@ func (page *ProviderListResultPage) NextWithContext(ctx context.Context) (err er
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.plr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.plr)
if err != nil {
return err
}
page.plr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.plr = next
return nil
}
@ -1451,6 +1492,21 @@ type TagDetails struct {
Values *[]TagValue `json:"values,omitempty"`
}
// MarshalJSON is the custom marshaler for TagDetails.
func (td TagDetails) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if td.TagName != nil {
objectMap["tagName"] = td.TagName
}
if td.Count != nil {
objectMap["count"] = td.Count
}
if td.Values != nil {
objectMap["values"] = td.Values
}
return json.Marshal(objectMap)
}
// TagsListResult list of subscription tags.
type TagsListResult struct {
autorest.Response `json:"-"`
@ -1528,10 +1584,15 @@ func (tlr TagsListResult) IsEmpty() bool {
return tlr.Value == nil || len(*tlr.Value) == 0
}
// hasNextLink returns true if the NextLink is not empty.
func (tlr TagsListResult) hasNextLink() bool {
return tlr.NextLink != nil && len(*tlr.NextLink) != 0
}
// tagsListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func (tlr TagsListResult) tagsListResultPreparer(ctx context.Context) (*http.Request, error) {
if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 {
if !tlr.hasNextLink() {
return nil, nil
}
return autorest.Prepare((&http.Request{}).WithContext(ctx),
@ -1559,11 +1620,16 @@ func (page *TagsListResultPage) NextWithContext(ctx context.Context) (err error)
tracing.EndSpan(ctx, sc, err)
}()
}
next, err := page.fn(ctx, page.tlr)
if err != nil {
return err
for {
next, err := page.fn(ctx, page.tlr)
if err != nil {
return err
}
page.tlr = next
if !next.hasNextLink() || !next.IsEmpty() {
break
}
}
page.tlr = next
return nil
}
@ -1608,6 +1674,18 @@ type TagValue struct {
Count *TagCount `json:"count,omitempty"`
}
// MarshalJSON is the custom marshaler for TagValue.
func (tv TagValue) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if tv.TagValue != nil {
objectMap["tagValue"] = tv.TagValue
}
if tv.Count != nil {
objectMap["count"] = tv.Count
}
return json.Marshal(objectMap)
}
// TargetResource target resource.
type TargetResource struct {
// ID - The ID of the resource.

View File

@ -112,7 +112,6 @@ func (client ProvidersClient) GetSender(req *http.Request) (*http.Response, erro
func (client ProvidersClient) GetResponder(resp *http.Response) (result Provider, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -154,6 +153,9 @@ func (client ProvidersClient) List(ctx context.Context, top *int32, expand strin
if err != nil {
err = autorest.NewErrorWithError(err, "resources.ProvidersClient", "List", resp, "Failure responding to request")
}
if result.plr.hasNextLink() && result.plr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -194,7 +196,6 @@ func (client ProvidersClient) ListSender(req *http.Request) (*http.Response, err
func (client ProvidersClient) ListResponder(resp *http.Response) (result ProviderListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -305,7 +306,6 @@ func (client ProvidersClient) RegisterSender(req *http.Request) (*http.Response,
func (client ProvidersClient) RegisterResponder(resp *http.Response) (result Provider, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -379,7 +379,6 @@ func (client ProvidersClient) UnregisterSender(req *http.Request) (*http.Respons
func (client ProvidersClient) UnregisterResponder(resp *http.Response) (result Provider, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -123,7 +123,6 @@ func (client Client) CheckExistenceSender(req *http.Request) (*http.Response, er
func (client Client) CheckExistenceResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusNotFound),
autorest.ByClosing())
result.Response = resp
@ -214,7 +213,6 @@ func (client Client) CreateOrUpdateSender(req *http.Request) (*http.Response, er
func (client Client) CreateOrUpdateResponder(resp *http.Response) (result GenericResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -303,7 +301,6 @@ func (client Client) DeleteSender(req *http.Request) (*http.Response, error) {
func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -391,7 +388,6 @@ func (client Client) GetSender(req *http.Request) (*http.Response, error) {
func (client Client) GetResponder(resp *http.Response) (result GenericResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -434,6 +430,9 @@ func (client Client) List(ctx context.Context, filter string, expand string, top
if err != nil {
err = autorest.NewErrorWithError(err, "resources.Client", "List", resp, "Failure responding to request")
}
if result.lr.hasNextLink() && result.lr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -477,7 +476,6 @@ func (client Client) ListSender(req *http.Request) (*http.Response, error) {
func (client Client) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -600,7 +598,6 @@ func (client Client) MoveResourcesSender(req *http.Request) (future MoveResource
func (client Client) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -692,7 +689,6 @@ func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err e
func (client Client) UpdateResponder(resp *http.Response) (result GenericResource, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -107,7 +107,6 @@ func (client TagsClient) CreateOrUpdateSender(req *http.Request) (*http.Response
func (client TagsClient) CreateOrUpdateResponder(resp *http.Response) (result TagDetails, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -183,7 +182,6 @@ func (client TagsClient) CreateOrUpdateValueSender(req *http.Request) (*http.Res
func (client TagsClient) CreateOrUpdateValueResponder(resp *http.Response) (result TagValue, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -257,7 +255,6 @@ func (client TagsClient) DeleteSender(req *http.Request) (*http.Response, error)
func (client TagsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -332,7 +329,6 @@ func (client TagsClient) DeleteValueSender(req *http.Request) (*http.Response, e
func (client TagsClient) DeleteValueResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -369,6 +365,9 @@ func (client TagsClient) List(ctx context.Context) (result TagsListResultPage, e
if err != nil {
err = autorest.NewErrorWithError(err, "resources.TagsClient", "List", resp, "Failure responding to request")
}
if result.tlr.hasNextLink() && result.tlr.IsEmpty() {
err = result.NextWithContext(ctx)
}
return
}
@ -403,7 +402,6 @@ func (client TagsClient) ListSender(req *http.Request) (*http.Response, error) {
func (client TagsClient) ListResponder(resp *http.Response) (result TagsListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version"
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/" + version.Number + " resources/2016-02-01"
return "Azure-SDK-For-Go/" + Version() + " resources/2016-02-01"
}
// Version returns the semantic version (see http://semver.org) of the client.

View File

@ -117,7 +117,6 @@ func (client AccountsClient) CheckNameAvailabilitySender(req *http.Request) (*ht
func (client AccountsClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameAvailabilityResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -216,7 +215,6 @@ func (client AccountsClient) CreateSender(req *http.Request) (future AccountsCre
func (client AccountsClient) CreateResponder(resp *http.Response) (result Account, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -300,7 +298,6 @@ func (client AccountsClient) DeleteSender(req *http.Request) (*http.Response, er
func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
@ -384,7 +381,6 @@ func (client AccountsClient) GetPropertiesSender(req *http.Request) (*http.Respo
func (client AccountsClient) GetPropertiesResponder(resp *http.Response) (result Account, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -456,7 +452,6 @@ func (client AccountsClient) ListSender(req *http.Request) (*http.Response, erro
func (client AccountsClient) ListResponder(resp *http.Response) (result AccountListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -531,7 +526,6 @@ func (client AccountsClient) ListByResourceGroupSender(req *http.Request) (*http
func (client AccountsClient) ListByResourceGroupResponder(resp *http.Response) (result AccountListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -615,7 +609,6 @@ func (client AccountsClient) ListKeysSender(req *http.Request) (*http.Response,
func (client AccountsClient) ListKeysResponder(resp *http.Response) (result AccountListKeysResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -704,7 +697,6 @@ func (client AccountsClient) RegenerateKeySender(req *http.Request) (*http.Respo
func (client AccountsClient) RegenerateKeyResponder(resp *http.Response) (result AccountListKeysResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
@ -796,7 +788,6 @@ func (client AccountsClient) UpdateSender(req *http.Request) (*http.Response, er
func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -0,0 +1,169 @@
package storage
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// 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.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// AccessTier enumerates the values for access tier.
type AccessTier string
const (
// Cool ...
Cool AccessTier = "Cool"
// Hot ...
Hot AccessTier = "Hot"
)
// PossibleAccessTierValues returns an array of possible values for the AccessTier const type.
func PossibleAccessTierValues() []AccessTier {
return []AccessTier{Cool, Hot}
}
// AccountStatus enumerates the values for account status.
type AccountStatus string
const (
// Available ...
Available AccountStatus = "Available"
// Unavailable ...
Unavailable AccountStatus = "Unavailable"
)
// PossibleAccountStatusValues returns an array of possible values for the AccountStatus const type.
func PossibleAccountStatusValues() []AccountStatus {
return []AccountStatus{Available, Unavailable}
}
// KeyPermission enumerates the values for key permission.
type KeyPermission string
const (
// FULL ...
FULL KeyPermission = "FULL"
// READ ...
READ KeyPermission = "READ"
)
// PossibleKeyPermissionValues returns an array of possible values for the KeyPermission const type.
func PossibleKeyPermissionValues() []KeyPermission {
return []KeyPermission{FULL, READ}
}
// Kind enumerates the values for kind.
type Kind string
const (
// BlobStorage ...
BlobStorage Kind = "BlobStorage"
// Storage ...
Storage Kind = "Storage"
)
// PossibleKindValues returns an array of possible values for the Kind const type.
func PossibleKindValues() []Kind {
return []Kind{BlobStorage, Storage}
}
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Creating ...
Creating ProvisioningState = "Creating"
// ResolvingDNS ...
ResolvingDNS ProvisioningState = "ResolvingDNS"
// Succeeded ...
Succeeded ProvisioningState = "Succeeded"
)
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{Creating, ResolvingDNS, Succeeded}
}
// Reason enumerates the values for reason.
type Reason string
const (
// AccountNameInvalid ...
AccountNameInvalid Reason = "AccountNameInvalid"
// AlreadyExists ...
AlreadyExists Reason = "AlreadyExists"
)
// PossibleReasonValues returns an array of possible values for the Reason const type.
func PossibleReasonValues() []Reason {
return []Reason{AccountNameInvalid, AlreadyExists}
}
// SkuName enumerates the values for sku name.
type SkuName string
const (
// PremiumLRS ...
PremiumLRS SkuName = "Premium_LRS"
// StandardGRS ...
StandardGRS SkuName = "Standard_GRS"
// StandardLRS ...
StandardLRS SkuName = "Standard_LRS"
// StandardRAGRS ...
StandardRAGRS SkuName = "Standard_RAGRS"
// StandardZRS ...
StandardZRS SkuName = "Standard_ZRS"
)
// PossibleSkuNameValues returns an array of possible values for the SkuName const type.
func PossibleSkuNameValues() []SkuName {
return []SkuName{PremiumLRS, StandardGRS, StandardLRS, StandardRAGRS, StandardZRS}
}
// SkuTier enumerates the values for sku tier.
type SkuTier string
const (
// Premium ...
Premium SkuTier = "Premium"
// Standard ...
Standard SkuTier = "Standard"
)
// PossibleSkuTierValues returns an array of possible values for the SkuTier const type.
func PossibleSkuTierValues() []SkuTier {
return []SkuTier{Premium, Standard}
}
// UsageUnit enumerates the values for usage unit.
type UsageUnit string
const (
// Bytes ...
Bytes UsageUnit = "Bytes"
// BytesPerSecond ...
BytesPerSecond UsageUnit = "BytesPerSecond"
// Count ...
Count UsageUnit = "Count"
// CountsPerSecond ...
CountsPerSecond UsageUnit = "CountsPerSecond"
// Percent ...
Percent UsageUnit = "Percent"
// Seconds ...
Seconds UsageUnit = "Seconds"
)
// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type.
func PossibleUsageUnitValues() []UsageUnit {
return []UsageUnit{Bytes, BytesPerSecond, Count, CountsPerSecond, Percent, Seconds}
}

View File

@ -29,157 +29,6 @@ import (
// The package's fully qualified name.
const fqdn = "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2016-01-01/storage"
// AccessTier enumerates the values for access tier.
type AccessTier string
const (
// Cool ...
Cool AccessTier = "Cool"
// Hot ...
Hot AccessTier = "Hot"
)
// PossibleAccessTierValues returns an array of possible values for the AccessTier const type.
func PossibleAccessTierValues() []AccessTier {
return []AccessTier{Cool, Hot}
}
// AccountStatus enumerates the values for account status.
type AccountStatus string
const (
// Available ...
Available AccountStatus = "Available"
// Unavailable ...
Unavailable AccountStatus = "Unavailable"
)
// PossibleAccountStatusValues returns an array of possible values for the AccountStatus const type.
func PossibleAccountStatusValues() []AccountStatus {
return []AccountStatus{Available, Unavailable}
}
// KeyPermission enumerates the values for key permission.
type KeyPermission string
const (
// FULL ...
FULL KeyPermission = "FULL"
// READ ...
READ KeyPermission = "READ"
)
// PossibleKeyPermissionValues returns an array of possible values for the KeyPermission const type.
func PossibleKeyPermissionValues() []KeyPermission {
return []KeyPermission{FULL, READ}
}
// Kind enumerates the values for kind.
type Kind string
const (
// BlobStorage ...
BlobStorage Kind = "BlobStorage"
// Storage ...
Storage Kind = "Storage"
)
// PossibleKindValues returns an array of possible values for the Kind const type.
func PossibleKindValues() []Kind {
return []Kind{BlobStorage, Storage}
}
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Creating ...
Creating ProvisioningState = "Creating"
// ResolvingDNS ...
ResolvingDNS ProvisioningState = "ResolvingDNS"
// Succeeded ...
Succeeded ProvisioningState = "Succeeded"
)
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues() []ProvisioningState {
return []ProvisioningState{Creating, ResolvingDNS, Succeeded}
}
// Reason enumerates the values for reason.
type Reason string
const (
// AccountNameInvalid ...
AccountNameInvalid Reason = "AccountNameInvalid"
// AlreadyExists ...
AlreadyExists Reason = "AlreadyExists"
)
// PossibleReasonValues returns an array of possible values for the Reason const type.
func PossibleReasonValues() []Reason {
return []Reason{AccountNameInvalid, AlreadyExists}
}
// SkuName enumerates the values for sku name.
type SkuName string
const (
// PremiumLRS ...
PremiumLRS SkuName = "Premium_LRS"
// StandardGRS ...
StandardGRS SkuName = "Standard_GRS"
// StandardLRS ...
StandardLRS SkuName = "Standard_LRS"
// StandardRAGRS ...
StandardRAGRS SkuName = "Standard_RAGRS"
// StandardZRS ...
StandardZRS SkuName = "Standard_ZRS"
)
// PossibleSkuNameValues returns an array of possible values for the SkuName const type.
func PossibleSkuNameValues() []SkuName {
return []SkuName{PremiumLRS, StandardGRS, StandardLRS, StandardRAGRS, StandardZRS}
}
// SkuTier enumerates the values for sku tier.
type SkuTier string
const (
// Premium ...
Premium SkuTier = "Premium"
// Standard ...
Standard SkuTier = "Standard"
)
// PossibleSkuTierValues returns an array of possible values for the SkuTier const type.
func PossibleSkuTierValues() []SkuTier {
return []SkuTier{Premium, Standard}
}
// UsageUnit enumerates the values for usage unit.
type UsageUnit string
const (
// Bytes ...
Bytes UsageUnit = "Bytes"
// BytesPerSecond ...
BytesPerSecond UsageUnit = "BytesPerSecond"
// Count ...
Count UsageUnit = "Count"
// CountsPerSecond ...
CountsPerSecond UsageUnit = "CountsPerSecond"
// Percent ...
Percent UsageUnit = "Percent"
// Seconds ...
Seconds UsageUnit = "Seconds"
)
// PossibleUsageUnitValues returns an array of possible values for the UsageUnit const type.
func PossibleUsageUnitValues() []UsageUnit {
return []UsageUnit{Bytes, BytesPerSecond, Count, CountsPerSecond, Percent, Seconds}
}
// Account the storage account.
type Account struct {
autorest.Response `json:"-"`
@ -479,8 +328,7 @@ type AccountRegenerateKeyParameters struct {
KeyName *string `json:"keyName,omitempty"`
}
// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
// AccountsCreateFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type AccountsCreateFuture struct {
azure.Future
}
@ -508,8 +356,7 @@ func (future *AccountsCreateFuture) Result(client AccountsClient) (a Account, er
return
}
// AccountUpdateParameters the parameters that can be provided when updating the storage account
// properties.
// AccountUpdateParameters the parameters that can be provided when updating the storage account properties.
type AccountUpdateParameters struct {
// Sku - Gets or sets the SKU name. Note that the SKU name cannot be updated to Standard_ZRS or Premium_LRS, nor can accounts of those sku names be updated to any other value.
Sku *Sku `json:"sku,omitempty"`
@ -610,6 +457,15 @@ type EncryptionService struct {
LastEnabledTime *date.Time `json:"lastEnabledTime,omitempty"`
}
// MarshalJSON is the custom marshaler for EncryptionService.
func (es EncryptionService) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if es.Enabled != nil {
objectMap["enabled"] = es.Enabled
}
return json.Marshal(objectMap)
}
// EncryptionServices a list of services that support encryption.
type EncryptionServices struct {
// Blob - The encryption function of the blob storage service.
@ -662,6 +518,15 @@ type Sku struct {
Tier SkuTier `json:"tier,omitempty"`
}
// MarshalJSON is the custom marshaler for Sku.
func (s Sku) MarshalJSON() ([]byte, error) {
objectMap := make(map[string]interface{})
if s.Name != "" {
objectMap["name"] = s.Name
}
return json.Marshal(objectMap)
}
// Usage describes Storage Resource Usage.
type Usage struct {
// Unit - READ-ONLY; Gets the unit of measurement. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond', 'BytesPerSecond'

View File

@ -104,7 +104,6 @@ func (client UsageClient) ListSender(req *http.Request) (*http.Response, error)
func (client UsageClient) ListResponder(resp *http.Response) (result UsageListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())

View File

@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version"
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
return "Azure-SDK-For-Go/" + version.Number + " storage/2016-01-01"
return "Azure-SDK-For-Go/" + Version() + " storage/2016-01-01"
}
// Version returns the semantic version (see http://semver.org) of the client.

View File

@ -18,4 +18,4 @@ package version
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
// Number contains the semantic version of this SDK.
const Number = "v40.3.0"
const Number = "v45.0.0"

32
vendor/github.com/Azure/go-autorest/.gitignore generated vendored Normal file
View File

@ -0,0 +1,32 @@
# The standard Go .gitignore file follows. (Sourced from: github.com/github/gitignore/master/Go.gitignore)
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
.DS_Store
.idea/
.vscode/
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
# go-autorest specific
vendor/
autorest/azure/example/example

1004
vendor/github.com/Azure/go-autorest/CHANGELOG.md generated vendored Normal file

File diff suppressed because it is too large Load Diff

23
vendor/github.com/Azure/go-autorest/GNUmakefile generated vendored Normal file
View File

@ -0,0 +1,23 @@
DIR?=./autorest/
default: build
build: fmt
go install $(DIR)
test:
go test $(DIR) || exit 1
vet:
@echo "go vet ."
@go vet $(DIR)... ; if [ $$? -eq 1 ]; then \
echo ""; \
echo "Vet found suspicious constructs. Please check the reported constructs"; \
echo "and fix them if necessary before submitting the code for review."; \
exit 1; \
fi
fmt:
gofmt -w $(DIR)
.PHONY: build test vet fmt

324
vendor/github.com/Azure/go-autorest/Gopkg.lock generated vendored Normal file
View File

@ -0,0 +1,324 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
digest = "1:892e39e5c083d0943f1e80ab8351690f183c6a5ab24e1d280adcad424c26255e"
name = "contrib.go.opencensus.io/exporter/ocagent"
packages = ["."]
pruneopts = "UT"
revision = "a8a6f458bbc1d5042322ad1f9b65eeb0b69be9ea"
version = "v0.6.0"
[[projects]]
digest = "1:8f5acd4d4462b5136af644d25101f0968a7a94ee90fcb2059cec5b7cc42e0b20"
name = "github.com/census-instrumentation/opencensus-proto"
packages = [
"gen-go/agent/common/v1",
"gen-go/agent/metrics/v1",
"gen-go/agent/trace/v1",
"gen-go/metrics/v1",
"gen-go/resource/v1",
"gen-go/trace/v1",
]
pruneopts = "UT"
revision = "d89fa54de508111353cb0b06403c00569be780d8"
version = "v0.2.1"
[[projects]]
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "UT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"
[[projects]]
digest = "1:76dc72490af7174349349838f2fe118996381b31ea83243812a97e5a0fd5ed55"
name = "github.com/dgrijalva/jwt-go"
packages = ["."]
pruneopts = "UT"
revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e"
version = "v3.2.0"
[[projects]]
digest = "1:cf0d2e435fd4ce45b789e93ef24b5f08e86be0e9807a16beb3694e2d8c9af965"
name = "github.com/dimchansky/utfbom"
packages = ["."]
pruneopts = "UT"
revision = "d2133a1ce379ef6fa992b0514a77146c60db9d1c"
version = "v1.1.0"
[[projects]]
branch = "master"
digest = "1:b7cb6054d3dff43b38ad2e92492f220f57ae6087ee797dca298139776749ace8"
name = "github.com/golang/groupcache"
packages = ["lru"]
pruneopts = "UT"
revision = "611e8accdfc92c4187d399e95ce826046d4c8d73"
[[projects]]
digest = "1:e3839df32927e8d3403cd5aa7253d966e8ff80fc8f10e2e35d146461cd83fcfa"
name = "github.com/golang/protobuf"
packages = [
"descriptor",
"jsonpb",
"proto",
"protoc-gen-go/descriptor",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/struct",
"ptypes/timestamp",
"ptypes/wrappers",
]
pruneopts = "UT"
revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
version = "v1.3.2"
[[projects]]
digest = "1:c560cd79300fac84f124b96225181a637a70b60155919a3c36db50b7cca6b806"
name = "github.com/grpc-ecosystem/grpc-gateway"
packages = [
"internal",
"runtime",
"utilities",
]
pruneopts = "UT"
revision = "f7120437bb4f6c71f7f5076ad65a45310de2c009"
version = "v1.12.1"
[[projects]]
digest = "1:5d231480e1c64a726869bc4142d270184c419749d34f167646baa21008eb0a79"
name = "github.com/mitchellh/go-homedir"
packages = ["."]
pruneopts = "UT"
revision = "af06845cf3004701891bf4fdb884bfe4920b3727"
version = "v1.1.0"
[[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
digest = "1:99d32780e5238c2621fff621123997c3e3cca96db8be13179013aea77dfab551"
name = "github.com/stretchr/testify"
packages = [
"assert",
"require",
]
pruneopts = "UT"
revision = "221dbe5ed46703ee255b1da0dec05086f5035f62"
version = "v1.4.0"
[[projects]]
digest = "1:7c5e00383399fe13de0b4b65c9fdde16275407ce8ac02d867eafeaa916edcc71"
name = "go.opencensus.io"
packages = [
".",
"internal",
"internal/tagencoding",
"metric/metricdata",
"metric/metricproducer",
"plugin/ocgrpc",
"plugin/ochttp",
"plugin/ochttp/propagation/b3",
"plugin/ochttp/propagation/tracecontext",
"resource",
"stats",
"stats/internal",
"stats/view",
"tag",
"trace",
"trace/internal",
"trace/propagation",
"trace/tracestate",
]
pruneopts = "UT"
revision = "aad2c527c5defcf89b5afab7f37274304195a6b2"
version = "v0.22.2"
[[projects]]
branch = "master"
digest = "1:f604f5e2ee721b6757d962dfe7bab4f28aae50c456e39cfb2f3819762a44a6ae"
name = "golang.org/x/crypto"
packages = [
"pkcs12",
"pkcs12/internal/rc2",
]
pruneopts = "UT"
revision = "e9b2fee46413994441b28dfca259d911d963dfed"
[[projects]]
branch = "master"
digest = "1:334b27eac455cb6567ea28cd424230b07b1a64334a2f861a8075ac26ce10af43"
name = "golang.org/x/lint"
packages = [
".",
"golint",
]
pruneopts = "UT"
revision = "fdd1cda4f05fd1fd86124f0ef9ce31a0b72c8448"
[[projects]]
branch = "master"
digest = "1:257a75d024975428ab9192bfc334c3490882f8cb21322ea5784ca8eca000a910"
name = "golang.org/x/net"
packages = [
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"trace",
]
pruneopts = "UT"
revision = "1ddd1de85cb0337b623b740a609d35817d516a8d"
[[projects]]
branch = "master"
digest = "1:382bb5a7fb4034db3b6a2d19e5a4a6bcf52f4750530603c01ca18a172fa3089b"
name = "golang.org/x/sync"
packages = ["semaphore"]
pruneopts = "UT"
revision = "cd5d95a43a6e21273425c7ae415d3df9ea832eeb"
[[projects]]
branch = "master"
digest = "1:4da420ceda5f68e8d748aa2169d0ed44ffadb1bbd6537cf778a49563104189b8"
name = "golang.org/x/sys"
packages = ["unix"]
pruneopts = "UT"
revision = "ce4227a45e2eb77e5c847278dcc6a626742e2945"
[[projects]]
digest = "1:8d8faad6b12a3a4c819a3f9618cb6ee1fa1cfc33253abeeea8b55336721e3405"
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/language",
"internal/language/compact",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable",
]
pruneopts = "UT"
revision = "342b2e1fbaa52c93f31447ad2c6abc048c63e475"
version = "v0.3.2"
[[projects]]
branch = "master"
digest = "1:4eb5ea8395fb60212dd58b92c9db80bab59d5e99c7435f9a6a0a528c373b60e7"
name = "golang.org/x/tools"
packages = [
"go/ast/astutil",
"go/gcexportdata",
"go/internal/gcimporter",
"go/types/typeutil",
]
pruneopts = "UT"
revision = "259af5ff87bdcd4abf2ecda8edc3f13f04f26a42"
[[projects]]
digest = "1:964bb30febc27fabfbec4759fa530c6ec35e77a7c85fed90b9317ea39a054877"
name = "google.golang.org/api"
packages = ["support/bundler"]
pruneopts = "UT"
revision = "8a410c21381766a810817fd6200fce8838ecb277"
version = "v0.14.0"
[[projects]]
branch = "master"
digest = "1:a8d5c2c6e746b3485e36908ab2a9e3d77b86b81f8156d88403c7d2b462431dfd"
name = "google.golang.org/genproto"
packages = [
"googleapis/api/httpbody",
"googleapis/rpc/status",
"protobuf/field_mask",
]
pruneopts = "UT"
revision = "51378566eb590fa106d1025ea12835a4416dda84"
[[projects]]
digest = "1:b59ce3ddb11daeeccccc9cb3183b58ebf8e9a779f1c853308cd91612e817a301"
name = "google.golang.org/grpc"
packages = [
".",
"backoff",
"balancer",
"balancer/base",
"balancer/roundrobin",
"binarylog/grpc_binarylog_v1",
"codes",
"connectivity",
"credentials",
"credentials/internal",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/balancerload",
"internal/binarylog",
"internal/buffer",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/grpcsync",
"internal/resolver/dns",
"internal/resolver/passthrough",
"internal/syscall",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"resolver",
"serviceconfig",
"stats",
"status",
"tap",
]
pruneopts = "UT"
revision = "1a3960e4bd028ac0cec0a2afd27d7d8e67c11514"
version = "v1.25.1"
[[projects]]
digest = "1:b75b3deb2bce8bc079e16bb2aecfe01eb80098f5650f9e93e5643ca8b7b73737"
name = "gopkg.in/yaml.v2"
packages = ["."]
pruneopts = "UT"
revision = "1f64d6156d11335c3f22d9330b0ad14fc1e789ce"
version = "v2.2.7"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"contrib.go.opencensus.io/exporter/ocagent",
"github.com/dgrijalva/jwt-go",
"github.com/dimchansky/utfbom",
"github.com/mitchellh/go-homedir",
"github.com/stretchr/testify/require",
"go.opencensus.io/plugin/ochttp",
"go.opencensus.io/plugin/ochttp/propagation/tracecontext",
"go.opencensus.io/stats/view",
"go.opencensus.io/trace",
"golang.org/x/crypto/pkcs12",
"golang.org/x/lint/golint",
]
solver-name = "gps-cdcl"
solver-version = 1

59
vendor/github.com/Azure/go-autorest/Gopkg.toml generated vendored Normal file
View File

@ -0,0 +1,59 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
required = ["golang.org/x/lint/golint"]
[prune]
go-tests = true
unused-packages = true
[[constraint]]
name = "contrib.go.opencensus.io/exporter/ocagent"
version = "0.6.0"
[[constraint]]
name = "github.com/dgrijalva/jwt-go"
version = "3.2.0"
[[constraint]]
name = "github.com/dimchansky/utfbom"
version = "1.1.0"
[[constraint]]
name = "github.com/mitchellh/go-homedir"
version = "1.1.0"
[[constraint]]
name = "github.com/stretchr/testify"
version = "1.3.0"
[[constraint]]
name = "go.opencensus.io"
version = "0.22.0"
[[constraint]]
branch = "master"
name = "golang.org/x/crypto"

191
vendor/github.com/Azure/go-autorest/LICENSE generated vendored Normal file
View File

@ -0,0 +1,191 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2015 Microsoft Corporation
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.

165
vendor/github.com/Azure/go-autorest/README.md generated vendored Normal file
View File

@ -0,0 +1,165 @@
# go-autorest
[![GoDoc](https://godoc.org/github.com/Azure/go-autorest/autorest?status.png)](https://godoc.org/github.com/Azure/go-autorest/autorest)
[![Build Status](https://dev.azure.com/azure-sdk/public/_apis/build/status/go/Azure.go-autorest?branchName=master)](https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=625&branchName=master)
[![Go Report Card](https://goreportcard.com/badge/Azure/go-autorest)](https://goreportcard.com/report/Azure/go-autorest)
Package go-autorest provides an HTTP request client for use with [Autorest](https://github.com/Azure/autorest.go)-generated API client packages.
An authentication client tested with Azure Active Directory (AAD) is also
provided in this repo in the package
`github.com/Azure/go-autorest/autorest/adal`. Despite its name, this package
is maintained only as part of the Azure Go SDK and is not related to other
"ADAL" libraries in [github.com/AzureAD](https://github.com/AzureAD).
## Overview
Package go-autorest implements an HTTP request pipeline suitable for use across
multiple goroutines and provides the shared routines used by packages generated
by [Autorest](https://github.com/Azure/autorest.go).
The package breaks sending and responding to HTTP requests into three phases: Preparing, Sending,
and Responding. A typical pattern is:
```go
req, err := Prepare(&http.Request{},
token.WithAuthorization())
resp, err := Send(req,
WithLogging(logger),
DoErrorIfStatusCode(http.StatusInternalServerError),
DoCloseIfError(),
DoRetryForAttempts(5, time.Second))
err = Respond(resp,
ByDiscardingBody(),
ByClosing())
```
Each phase relies on decorators to modify and / or manage processing. Decorators may first modify
and then pass the data along, pass the data first and then modify the result, or wrap themselves
around passing the data (such as a logger might do). Decorators run in the order provided. For
example, the following:
```go
req, err := Prepare(&http.Request{},
WithBaseURL("https://microsoft.com/"),
WithPath("a"),
WithPath("b"),
WithPath("c"))
```
will set the URL to:
```
https://microsoft.com/a/b/c
```
Preparers and Responders may be shared and re-used (assuming the underlying decorators support
sharing and re-use). Performant use is obtained by creating one or more Preparers and Responders
shared among multiple go-routines, and a single Sender shared among multiple sending go-routines,
all bound together by means of input / output channels.
Decorators hold their passed state within a closure (such as the path components in the example
above). Be careful to share Preparers and Responders only in a context where such held state
applies. For example, it may not make sense to share a Preparer that applies a query string from a
fixed set of values. Similarly, sharing a Responder that reads the response body into a passed
struct (e.g., `ByUnmarshallingJson`) is likely incorrect.
Errors raised by autorest objects and methods will conform to the `autorest.Error` interface.
See the included examples for more detail. For details on the suggested use of this package by
generated clients, see the Client described below.
## Helpers
### Handling Swagger Dates
The Swagger specification (https://swagger.io) that drives AutoRest
(https://github.com/Azure/autorest/) precisely defines two date forms: date and date-time. The
github.com/Azure/go-autorest/autorest/date package provides time.Time derivations to ensure correct
parsing and formatting.
### Handling Empty Values
In JSON, missing values have different semantics than empty values. This is especially true for
services using the HTTP PATCH verb. The JSON submitted with a PATCH request generally contains
only those values to modify. Missing values are to be left unchanged. Developers, then, require a
means to both specify an empty value and to leave the value out of the submitted JSON.
The Go JSON package (`encoding/json`) supports the `omitempty` tag. When specified, it omits
empty values from the rendered JSON. Since Go defines default values for all base types (such as ""
for string and 0 for int) and provides no means to mark a value as actually empty, the JSON package
treats default values as meaning empty, omitting them from the rendered JSON. This means that, using
the Go base types encoded through the default JSON package, it is not possible to create JSON to
clear a value at the server.
The workaround within the Go community is to use pointers to base types in lieu of base types within
structures that map to JSON. For example, instead of a value of type `string`, the workaround uses
`*string`. While this enables distinguishing empty values from those to be unchanged, creating
pointers to a base type (notably constant, in-line values) requires additional variables. This, for
example,
```go
s := struct {
S *string
}{ S: &"foo" }
```
fails, while, this
```go
v := "foo"
s := struct {
S *string
}{ S: &v }
```
succeeds.
To ease using pointers, the subpackage `to` contains helpers that convert to and from pointers for
Go base types which have Swagger analogs. It also provides a helper that converts between
`map[string]string` and `map[string]*string`, enabling the JSON to specify that the value
associated with a key should be cleared. With the helpers, the previous example becomes
```go
s := struct {
S *string
}{ S: to.StringPtr("foo") }
```
## Install
```bash
go get github.com/Azure/go-autorest/autorest
go get github.com/Azure/go-autorest/autorest/azure
go get github.com/Azure/go-autorest/autorest/date
go get github.com/Azure/go-autorest/autorest/to
```
### Using with Go Modules
In [v12.0.1](https://github.com/Azure/go-autorest/pull/386), this repository introduced the following modules.
- autorest/adal
- autorest/azure/auth
- autorest/azure/cli
- autorest/date
- autorest/mocks
- autorest/to
- autorest/validation
- autorest
- logger
- tracing
Tagging cumulative SDK releases as a whole (e.g. `v12.3.0`) is still enabled to support consumers of this repo that have not yet migrated to modules.
## License
See LICENSE file.
-----
This project has adopted the [Microsoft Open Source Code of
Conduct](https://opensource.microsoft.com/codeofconduct/). For more information
see the [Code of Conduct
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional
questions or comments.

View File

@ -3,10 +3,10 @@ module github.com/Azure/go-autorest/autorest/adal
go 1.12
require (
github.com/Azure/go-autorest/autorest v0.9.0
github.com/Azure/go-autorest/autorest/date v0.2.0
github.com/Azure/go-autorest/autorest/mocks v0.3.0
github.com/Azure/go-autorest/tracing v0.5.0
github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/mocks v0.4.0
github.com/Azure/go-autorest/tracing v0.6.0
github.com/dgrijalva/jwt-go v3.2.0+incompatible
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
)

View File

@ -1,26 +1,17 @@
github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
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/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.0 h1:z20OWOSG5aCye0HEkDp6TPmP17ZcfeMxPi6HnSALa8c=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
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/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -16,9 +16,9 @@ package adal
// See the License for the specific language governing permissions and
// limitations under the License.
// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest/autorest"
import _ "github.com/Azure/go-autorest"

View File

@ -771,8 +771,9 @@ func (spt *ServicePrincipalToken) EnsureFresh() error {
// EnsureFreshWithContext will refresh the token if it will expire within the refresh window (as set by
// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use.
func (spt *ServicePrincipalToken) EnsureFreshWithContext(ctx context.Context) error {
if spt.inner.AutoRefresh && spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) {
// take the write lock then check to see if the token was already refreshed
// must take the read lock when initially checking the token's expiration
if spt.inner.AutoRefresh && spt.Token().WillExpireIn(spt.inner.RefreshWithin) {
// take the write lock then check again to see if the token was already refreshed
spt.refreshLock.Lock()
defer spt.refreshLock.Unlock()
if spt.inner.Token.WillExpireIn(spt.inner.RefreshWithin) {

View File

@ -138,6 +138,11 @@ func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator {
}
}
// TokenProvider returns OAuthTokenProvider so that it can be used for authorization outside the REST.
func (ba *BearerAuthorizer) TokenProvider() adal.OAuthTokenProvider {
return ba.tokenProvider
}
// BearerAuthorizerCallbackFunc is the authentication callback signature.
type BearerAuthorizerCallbackFunc func(tenantID, resource string) (*BearerAuthorizer, error)
@ -331,7 +336,7 @@ func (mt multiTenantSPTAuthorizer) WithAuthorization() PrepareDecorator {
for i := range auxTokens {
auxTokens[i] = fmt.Sprintf("Bearer %s", auxTokens[i])
}
return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, "; ")))
return Prepare(r, WithHeader(headerAuxAuthorization, strings.Join(auxTokens, ", ")))
})
}
}

View File

@ -54,13 +54,10 @@ func (sas *SASTokenAuthorizer) WithAuthorization() PrepareDecorator {
return r, err
}
if r.URL.RawQuery != "" {
// When retrying the request we need to ensure the sasToken isn't present
if !strings.Contains(r.URL.RawQuery, sas.sasToken) {
r.URL.RawQuery = fmt.Sprintf("%s&%s", r.URL.RawQuery, sas.sasToken)
}
} else {
if r.URL.RawQuery == "" {
r.URL.RawQuery = sas.sasToken
} else if !strings.Contains(r.URL.RawQuery, sas.sasToken) {
r.URL.RawQuery = fmt.Sprintf("%s&%s", r.URL.RawQuery, sas.sasToken)
}
return Prepare(r)

View File

@ -35,9 +35,6 @@ const (
// SharedKey is used to authorize against blobs, files and queues services.
SharedKey SharedKeyType = "sharedKey"
// SharedKey is used to authorize against the account.
SharedKeyForAccount SharedKeyType = "sharedKeyAccount"
// SharedKeyForTable is used to authorize against the table service.
SharedKeyForTable SharedKeyType = "sharedKeyTable"
@ -130,14 +127,6 @@ func buildSharedKey(accName string, accKey []byte, req *http.Request, keyType Sh
date := time.Now().UTC().Format(http.TimeFormat)
req.Header.Set(headerXMSDate, date)
}
if keyType == SharedKeyForAccount {
// ensure a content length is set if appropriate
if req.Header.Get(headerContentLength) == "" {
req.Header.Set("Content-Length", fmt.Sprintf("%d", int(req.ContentLength)))
}
}
canString, err := buildCanonicalizedString(req.Method, req.Header, canRes, keyType)
if err != nil {
return "", err
@ -156,9 +145,6 @@ func buildCanonicalizedResource(accountName, uri string, keyType SharedKeyType)
if accountName != storageEmulatorAccountName {
cr.WriteString("/")
cr.WriteString(getCanonicalizedAccountName(accountName))
if keyType == SharedKeyForAccount {
cr.WriteString("/")
}
}
if len(u.Path) > 0 {
@ -166,6 +152,9 @@ func buildCanonicalizedResource(accountName, uri string, keyType SharedKeyType)
// the resource's URI should be encoded exactly as it is in the URI.
// -- https://msdn.microsoft.com/en-gb/library/azure/dd179428.aspx
cr.WriteString(u.EscapedPath())
} else {
// a slash is required to indicate the root path
cr.WriteString("/")
}
params, err := url.ParseQuery(u.RawQuery)
@ -174,7 +163,7 @@ func buildCanonicalizedResource(accountName, uri string, keyType SharedKeyType)
}
// See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277
if keyType == SharedKey || keyType == SharedKeyForAccount {
if keyType == SharedKey {
if len(params) > 0 {
cr.WriteString("\n")
@ -217,7 +206,7 @@ func buildCanonicalizedString(verb string, headers http.Header, canonicalizedRes
}
date := headers.Get(headerDate)
if v := headers.Get(headerXMSDate); v != "" {
if keyType == SharedKey || keyType == SharedKeyForAccount || keyType == SharedKeyLite {
if keyType == SharedKey || keyType == SharedKeyLite {
date = ""
} else {
date = v
@ -225,7 +214,7 @@ func buildCanonicalizedString(verb string, headers http.Header, canonicalizedRes
}
var canString string
switch keyType {
case SharedKey, SharedKeyForAccount:
case SharedKey:
canString = strings.Join([]string{
verb,
headers.Get(headerContentEncoding),
@ -309,7 +298,7 @@ func createAuthorizationHeader(accountName string, accountKey []byte, canonicali
signature := base64.StdEncoding.EncodeToString(h.Sum(nil))
var key string
switch keyType {
case SharedKey, SharedKeyForAccount, SharedKeyForTable:
case SharedKey, SharedKeyForTable:
key = "SharedKey"
case SharedKeyLite, SharedKeyLiteForTable:
key = "SharedKeyLite"

View File

@ -167,7 +167,13 @@ func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Clien
cancelCtx, cancel = context.WithTimeout(ctx, d)
defer cancel()
}
// if the initial response has a Retry-After, sleep for the specified amount of time before starting to poll
if delay, ok := f.GetPollingDelay(); ok {
if delayElapsed := autorest.DelayForBackoff(delay, 0, cancelCtx.Done()); !delayElapsed {
err = cancelCtx.Err()
return
}
}
done, err := f.DoneWithContext(ctx, client)
for attempts := 0; !done; done, err = f.DoneWithContext(ctx, client) {
if attempts >= client.RetryAttempts {

View File

@ -3,9 +3,9 @@ module github.com/Azure/go-autorest/autorest/azure/cli
go 1.12
require (
github.com/Azure/go-autorest/autorest v0.9.0
github.com/Azure/go-autorest/autorest/adal v0.6.0
github.com/Azure/go-autorest/autorest/date v0.2.0
github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest/autorest/adal v0.9.0
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/dimchansky/utfbom v1.1.0
github.com/mitchellh/go-homedir v1.1.0
)

View File

@ -1,23 +1,13 @@
github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.6.0 h1:UCTq22yE3RPgbU/8u4scfnnzuCW6pwQ9n+uBtV78ouo=
github.com/Azure/go-autorest/autorest/adal v0.6.0/go.mod h1:Z6vX6WXXuyieHAXwMj0S6HY6e6wcHn37qQMBQlvY3lc=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
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/adal v0.9.0 h1:SigMbuFNuKgc1xcGhaeapbh+8fgsu+GxgDRFyg7f5lM=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
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.0 h1:z20OWOSG5aCye0HEkDp6TPmP17ZcfeMxPi6HnSALa8c=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
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/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dimchansky/utfbom v1.1.0 h1:FcM3g+nofKgUteL8dm/UpdRXNC9KmADgTpLKsu0TRo4=
@ -25,5 +15,9 @@ github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQ
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@ -16,9 +16,9 @@ package cli
// See the License for the specific language governing permissions and
// limitations under the License.
// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest/autorest"
import _ "github.com/Azure/go-autorest"

View File

@ -51,9 +51,13 @@ type User struct {
const azureProfileJSON = "azureProfile.json"
func configDir() string {
return os.Getenv("AZURE_CONFIG_DIR")
}
// ProfilePath returns the path where the Azure Profile is stored from the Azure CLI
func ProfilePath() (string, error) {
if cfgDir := os.Getenv("AZURE_CONFIG_DIR"); cfgDir != "" {
if cfgDir := configDir(); cfgDir != "" {
return filepath.Join(cfgDir, azureProfileJSON), nil
}
return homedir.Expand("~/.azure/" + azureProfileJSON)

View File

@ -20,6 +20,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"regexp"
"runtime"
"strconv"
@ -44,6 +45,8 @@ type Token struct {
UserID string `json:"userId"`
}
const accessTokensJSON = "accessTokens.json"
// ToADALToken converts an Azure CLI `Token`` to an `adal.Token``
func (t Token) ToADALToken() (converted adal.Token, err error) {
tokenExpirationDate, err := ParseExpirationDate(t.ExpiresOn)
@ -68,17 +71,19 @@ func (t Token) ToADALToken() (converted adal.Token, err error) {
// AccessTokensPath returns the path where access tokens are stored from the Azure CLI
// TODO(#199): add unit test.
func AccessTokensPath() (string, error) {
// Azure-CLI allows user to customize the path of access tokens thorugh environment variable.
var accessTokenPath = os.Getenv("AZURE_ACCESS_TOKEN_FILE")
var err error
// Azure-CLI allows user to customize the path of access tokens through environment variable.
if accessTokenPath := os.Getenv("AZURE_ACCESS_TOKEN_FILE"); accessTokenPath != "" {
return accessTokenPath, nil
}
// Azure-CLI allows user to customize the path to Azure config directory through environment variable.
if cfgDir := configDir(); cfgDir != "" {
return filepath.Join(cfgDir, accessTokensJSON), nil
}
// Fallback logic to default path on non-cloud-shell environment.
// TODO(#200): remove the dependency on hard-coding path.
if accessTokenPath == "" {
accessTokenPath, err = homedir.Expand("~/.azure/accessTokens.json")
}
return accessTokenPath, err
return homedir.Expand("~/.azure/" + accessTokensJSON)
}
// ParseExpirationDate parses either a Azure CLI or CloudShell date into a time object

View File

@ -71,6 +71,7 @@ type Environment struct {
ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"`
CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"`
TokenAudience string `json:"tokenAudience"`
APIManagementHostNameSuffix string `json:"apiManagementHostNameSuffix"`
ResourceIdentifiers ResourceIdentifier `json:"resourceIdentifiers"`
}
@ -98,6 +99,7 @@ var (
ContainerRegistryDNSSuffix: "azurecr.io",
CosmosDBDNSSuffix: "documents.azure.com",
TokenAudience: "https://management.azure.com/",
APIManagementHostNameSuffix: "azure-api.net",
ResourceIdentifiers: ResourceIdentifier{
Graph: "https://graph.windows.net/",
KeyVault: "https://vault.azure.net",
@ -127,10 +129,11 @@ var (
KeyVaultDNSSuffix: "vault.usgovcloudapi.net",
ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net",
ServiceManagementVMDNSSuffix: "usgovcloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us",
ResourceManagerVMDNSSuffix: "cloudapp.usgovcloudapi.net",
ContainerRegistryDNSSuffix: "azurecr.us",
CosmosDBDNSSuffix: "documents.azure.us",
TokenAudience: "https://management.usgovcloudapi.net/",
APIManagementHostNameSuffix: "azure-api.us",
ResourceIdentifiers: ResourceIdentifier{
Graph: "https://graph.windows.net/",
KeyVault: "https://vault.usgovcloudapi.net",
@ -160,10 +163,11 @@ var (
KeyVaultDNSSuffix: "vault.azure.cn",
ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn",
ServiceManagementVMDNSSuffix: "chinacloudapp.cn",
ResourceManagerVMDNSSuffix: "cloudapp.azure.cn",
ResourceManagerVMDNSSuffix: "cloudapp.chinacloudapi.cn",
ContainerRegistryDNSSuffix: "azurecr.cn",
CosmosDBDNSSuffix: "documents.azure.cn",
TokenAudience: "https://management.chinacloudapi.cn/",
APIManagementHostNameSuffix: "azure-api.cn",
ResourceIdentifiers: ResourceIdentifier{
Graph: "https://graph.chinacloudapi.cn/",
KeyVault: "https://vault.azure.cn",
@ -197,6 +201,7 @@ var (
ContainerRegistryDNSSuffix: NotAvailable,
CosmosDBDNSSuffix: "documents.microsoftazure.de",
TokenAudience: "https://management.microsoftazure.de/",
APIManagementHostNameSuffix: NotAvailable,
ResourceIdentifiers: ResourceIdentifier{
Graph: "https://graph.cloudapi.de/",
KeyVault: "https://vault.microsoftazure.de",
@ -242,3 +247,8 @@ func EnvironmentFromFile(location string) (unmarshaled Environment, err error) {
return
}
// SetEnvironment updates the environment map with the specified values.
func SetEnvironment(name string, env Environment) {
environments[strings.ToUpper(name)] = env
}

View File

@ -2,4 +2,4 @@ module github.com/Azure/go-autorest/autorest/date
go 1.12
require github.com/Azure/go-autorest/autorest v0.9.0
require github.com/Azure/go-autorest v14.2.0+incompatible

View File

@ -1,16 +1,2 @@
github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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=

View File

@ -16,9 +16,9 @@ package date
// See the License for the specific language governing permissions and
// limitations under the License.
// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest/autorest"
import _ "github.com/Azure/go-autorest"

View File

@ -3,9 +3,10 @@ module github.com/Azure/go-autorest/autorest
go 1.12
require (
github.com/Azure/go-autorest/autorest/adal v0.8.2
github.com/Azure/go-autorest/autorest/mocks v0.3.0
github.com/Azure/go-autorest/logger v0.1.0
github.com/Azure/go-autorest/tracing v0.5.0
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413
github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest/autorest/adal v0.9.0
github.com/Azure/go-autorest/autorest/mocks v0.4.0
github.com/Azure/go-autorest/logger v0.2.0
github.com/Azure/go-autorest/tracing v0.6.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
)

View File

@ -1,28 +1,21 @@
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.8.2 h1:O1X4oexUxnZCaEUGsvMnr8ZGj8HI37tNezwY4npRqA0=
github.com/Azure/go-autorest/autorest/adal v0.8.2/go.mod h1:ZjhuQClTqx435SRJ2iMlOxPYt3d2C/T/7TiQCVZSn3Q=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/date v0.2.0 h1:yW+Zlqf26583pE43KhfnhFcdmSWlm5Ew6bxipnr/tbM=
github.com/Azure/go-autorest/autorest/date v0.2.0/go.mod h1:vcORJHLJEh643/Ioh9+vPmf1Ij9AEBM5FuBIXLmIy0g=
github.com/Azure/go-autorest/autorest/mocks v0.1.0 h1:Kx+AUU2Te+A3JIyYn6Dfs+cFgx5XorQKuIXrZGoq/SI=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.3.0 h1:qJumjCaCudz+OcqE9/XtEPfvtOjOmKaui4EOpFI6zZc=
github.com/Azure/go-autorest/autorest/mocks v0.3.0/go.mod h1:a8FDP3DYzQ4RYfVAxAN3SVSiiO77gL2j2ronKKP0syM=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
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/adal v0.9.0 h1:SigMbuFNuKgc1xcGhaeapbh+8fgsu+GxgDRFyg7f5lM=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
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.0 h1:z20OWOSG5aCye0HEkDp6TPmP17ZcfeMxPi6HnSALa8c=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/logger v0.2.0 h1:e4RVHVZKC5p6UANLJHkM4OfR1UKZPj8Wt8Pcx+3oqrE=
github.com/Azure/go-autorest/logger v0.2.0/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/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -0,0 +1,24 @@
// +build modhack
package autorest
// Copyright 2017 Microsoft Corporation
//
// 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.
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest"

View File

@ -2,4 +2,4 @@ module github.com/Azure/go-autorest/autorest/to
go 1.12
require github.com/Azure/go-autorest/autorest v0.9.0
require github.com/Azure/go-autorest v14.2.0+incompatible

View File

@ -1,17 +1,2 @@
github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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=

View File

@ -16,9 +16,9 @@ package to
// See the License for the specific language governing permissions and
// limitations under the License.
// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest/autorest"
import _ "github.com/Azure/go-autorest"

View File

@ -3,6 +3,6 @@ module github.com/Azure/go-autorest/autorest/validation
go 1.12
require (
github.com/Azure/go-autorest/autorest v0.9.0
github.com/Azure/go-autorest v14.2.0+incompatible
github.com/stretchr/testify v1.3.0
)

View File

@ -1,24 +1,9 @@
github.com/Azure/go-autorest/autorest v0.9.0 h1:MRvx8gncNaXJqOoLmhNjUAKh33JJF8LyxPhomEtOsjs=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest/adal v0.5.0 h1:q2gDruN08/guU9vAjuPWff0+QIrpH6ediguzdAzXAUU=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/date v0.1.0 h1:YGrhWfrgtFs84+h0o46rJrlmsZtyZRg470CqAXTZaGM=
github.com/Azure/go-autorest/autorest/date v0.1.0/go.mod h1:plvfp3oPSKwf2DNjlBjWF/7vwR+cUD/ELuzDCXwHUVA=
github.com/Azure/go-autorest/autorest/mocks v0.1.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0 h1:Ww5g4zThfD/6cLb4z6xxgeyDa7QDkizMkJKe0ysZXp0=
github.com/Azure/go-autorest/autorest/mocks v0.2.0/go.mod h1:OTyCOPRA2IgIlWxVYxBee2F5Gr4kF2zd2J5cFRaIDN0=
github.com/Azure/go-autorest/logger v0.1.0 h1:ruG4BSDXONFRrZZJ2GUXDiUyVpayPmb1GnWeHDdaNKY=
github.com/Azure/go-autorest/logger v0.1.0/go.mod h1:oExouG+K6PryycPJfVSxi/koC6LSNgds39diKLz7Vrc=
github.com/Azure/go-autorest/tracing v0.5.0 h1:TRn4WjSnkcSy5AEG3pnbtFSwNtwzjr4VYyQflFE619k=
github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk=
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/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View File

@ -16,9 +16,9 @@ package validation
// See the License for the specific language governing permissions and
// limitations under the License.
// This file, and the github.com/Azure/go-autorest/autorest import, won't actually become part of
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest/autorest"
import _ "github.com/Azure/go-autorest"

View File

@ -19,7 +19,7 @@ import (
"runtime"
)
const number = "v14.0.0"
const number = "v14.2.1"
var (
userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s",

105
vendor/github.com/Azure/go-autorest/azure-pipelines.yml generated vendored Normal file
View File

@ -0,0 +1,105 @@
variables:
GOPATH: '$(system.defaultWorkingDirectory)/work'
sdkPath: '$(GOPATH)/src/github.com/$(build.repository.name)'
jobs:
- job: 'goautorest'
displayName: 'Run go-autorest CI Checks'
strategy:
matrix:
Linux_Go113:
vm.image: 'ubuntu-18.04'
go.version: '1.13'
Linux_Go114:
vm.image: 'ubuntu-18.04'
go.version: '1.14'
pool:
vmImage: '$(vm.image)'
steps:
- task: GoTool@0
inputs:
version: '$(go.version)'
displayName: "Select Go Version"
- script: |
set -e
mkdir -p '$(GOPATH)/bin'
mkdir -p '$(sdkPath)'
shopt -s extglob
mv !(work) '$(sdkPath)'
echo '##vso[task.prependpath]$(GOPATH)/bin'
displayName: 'Create Go Workspace'
- script: |
set -e
curl -sSL https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure -v
go install ./vendor/golang.org/x/lint/golint
go get github.com/jstemmer/go-junit-report
go get github.com/axw/gocov/gocov
go get github.com/AlekSi/gocov-xml
go get -u github.com/matm/gocov-html
workingDirectory: '$(sdkPath)'
displayName: 'Install Dependencies'
- script: |
go vet ./autorest/...
go vet ./logger/...
go vet ./tracing/...
workingDirectory: '$(sdkPath)'
displayName: 'Vet'
- script: |
go build -v ./autorest/...
go build -v ./logger/...
go build -v ./tracing/...
workingDirectory: '$(sdkPath)'
displayName: 'Build'
- script: |
set -e
go test -race -v -coverprofile=coverage.txt -covermode atomic ./autorest/... ./logger/... ./tracing/... 2>&1 | go-junit-report > report.xml
gocov convert coverage.txt > coverage.json
gocov-xml < coverage.json > coverage.xml
gocov-html < coverage.json > coverage.html
workingDirectory: '$(sdkPath)'
displayName: 'Run Tests'
- script: grep -L -r --include *.go --exclude-dir vendor -P "Copyright (\d{4}|\(c\)) Microsoft" ./ | tee >&2
workingDirectory: '$(sdkPath)'
displayName: 'Copyright Header Check'
failOnStderr: true
condition: succeededOrFailed()
- script: |
gofmt -s -l -w ./autorest/. >&2
gofmt -s -l -w ./logger/. >&2
gofmt -s -l -w ./tracing/. >&2
workingDirectory: '$(sdkPath)'
displayName: 'Format Check'
failOnStderr: true
condition: succeededOrFailed()
- script: |
golint ./autorest/... >&2
golint ./logger/... >&2
golint ./tracing/... >&2
workingDirectory: '$(sdkPath)'
displayName: 'Linter Check'
failOnStderr: true
condition: succeededOrFailed()
- task: PublishTestResults@2
inputs:
testRunner: JUnit
testResultsFiles: $(sdkPath)/report.xml
failTaskOnFailedTests: true
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(sdkPath)/coverage.xml
additionalCodeCoverageFiles: $(sdkPath)/coverage.html

18
vendor/github.com/Azure/go-autorest/doc.go generated vendored Normal file
View File

@ -0,0 +1,18 @@
/*
Package go-autorest provides an HTTP request client for use with Autorest-generated API client packages.
*/
package go_autorest
// Copyright 2017 Microsoft Corporation
//
// 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.

View File

@ -1,3 +1,5 @@
module github.com/Azure/go-autorest/logger
go 1.12
require github.com/Azure/go-autorest v14.2.0+incompatible

2
vendor/github.com/Azure/go-autorest/logger/go.sum generated vendored Normal file
View File

@ -0,0 +1,2 @@
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=

View File

@ -0,0 +1,24 @@
// +build modhack
package logger
// Copyright 2017 Microsoft Corporation
//
// 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.
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest"

View File

@ -1,3 +1,5 @@
module github.com/Azure/go-autorest/tracing
go 1.12
require github.com/Azure/go-autorest v14.2.0+incompatible

2
vendor/github.com/Azure/go-autorest/tracing/go.sum generated vendored Normal file
View File

@ -0,0 +1,2 @@
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=

View File

@ -0,0 +1,24 @@
// +build modhack
package tracing
// Copyright 2017 Microsoft Corporation
//
// 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.
// This file, and the github.com/Azure/go-autorest import, won't actually become part of
// the resultant binary.
// Necessary for safely adding multi-module repo.
// See: https://github.com/golang/go/wiki/Modules#is-it-possible-to-add-a-module-to-a-multi-module-repository
import _ "github.com/Azure/go-autorest"

View File

@ -14,6 +14,15 @@ import (
"github.com/hashicorp/go-multierror"
)
type azureCLIProfile struct {
subscription *cli.Subscription
clientId string
environment string
subscriptionId string
tenantId string
}
type azureCliTokenAuth struct {
profile *azureCLIProfile
servicePrincipalAuthDocsLink string
@ -22,28 +31,22 @@ type azureCliTokenAuth struct {
func (a azureCliTokenAuth) build(b Builder) (authMethod, error) {
auth := azureCliTokenAuth{
profile: &azureCLIProfile{
clientId: b.ClientID,
environment: b.Environment,
subscriptionId: b.SubscriptionID,
tenantId: b.TenantID,
clientId: "04b07795-8ddb-461a-bbee-02f9e1bf7b46", // fixed first party client id for Az CLI
},
servicePrincipalAuthDocsLink: b.ClientSecretDocsLink,
}
profilePath, err := cli.ProfilePath()
if err != nil {
return nil, fmt.Errorf("Error loading the Profile Path from the Azure CLI: %+v", err)
}
profile, err := cli.LoadProfile(profilePath)
sub, err := obtainSubscription(b.SubscriptionID)
if err != nil {
return nil, fmt.Errorf("Azure CLI Authorization Profile was not found. Please ensure the Azure CLI is installed and then log-in with `az login`.")
return nil, fmt.Errorf("obtain subscription(%s) from Azure CLI: %+v", b.SubscriptionID, err)
}
auth.profile.profile = profile
auth.profile.subscription = sub
// Authenticating as a Service Principal doesn't return all of the information we need for authentication purposes
// as such Service Principal authentication is supported using the specific auth method
if authenticatedAsAUser := auth.profile.verifyAuthenticatedAsAUser(); !authenticatedAsAUser {
if sub.User == nil || !strings.EqualFold(sub.User.Type, "user") {
return nil, fmt.Errorf(`Authenticating using the Azure CLI is only supported as a User (not a Service Principal).
To authenticate to Azure using a Service Principal, you can use the separate 'Authenticate using a Service Principal'
@ -52,15 +55,15 @@ auth method - instructions for which can be found here: %s
Alternatively you can authenticate using the Azure CLI by using a User Account.`, auth.servicePrincipalAuthDocsLink)
}
err = auth.profile.populateFields()
if err != nil {
return nil, fmt.Errorf("Error retrieving the Profile from the Azure CLI: %s Please re-authenticate using `az login`.", err)
// Populate fields
if auth.profile.subscriptionId == "" {
auth.profile.subscriptionId = sub.ID
}
err = auth.profile.populateClientId()
if err != nil {
return nil, fmt.Errorf("Error populating Client ID from the Azure CLI: %+v", err)
if auth.profile.tenantId == "" {
auth.profile.tenantId = sub.TenantID
}
// always pull the environment from the Azure CLI, since the Access Token's associated with it
auth.profile.environment = normalizeEnvironmentName(sub.EnvironmentName)
return auth, nil
}
@ -179,6 +182,23 @@ func obtainAuthorizationToken(endpoint string, subscriptionId string) (*cli.Toke
return &token, nil
}
// obtainSubscription return a subscription object of the specified subscriptionId.
// If the subscriptionId is empty, it returns the default subscription.
func obtainSubscription(subscriptionId string) (*cli.Subscription, error) {
var sub cli.Subscription
cmd := make([]string, 0)
cmd = []string{"account", "show", "-o=json"}
if subscriptionId != "" {
cmd = append(cmd, "-s", subscriptionId)
}
err := jsonUnmarshalAzCmd(&sub, cmd...)
if err != nil {
return nil, fmt.Errorf("Error parsing json result from the Azure CLI: %v", err)
}
return &sub, nil
}
func jsonUnmarshalAzCmd(i interface{}, arg ...string) error {
var stderr bytes.Buffer
var stdout bytes.Buffer

View File

@ -1,42 +0,0 @@
package authentication
import (
"fmt"
"log"
"strings"
"github.com/Azure/go-autorest/autorest/adal"
"github.com/Azure/go-autorest/autorest/azure/cli"
)
type azureCliAccessToken struct {
ClientID string
AccessToken *adal.Token
}
func findValidAccessTokenForTenant(tokens []cli.Token, tenantId string) (*azureCliAccessToken, error) {
for _, accessToken := range tokens {
token, err := accessToken.ToADALToken()
if err != nil {
return nil, fmt.Errorf("[DEBUG] Error converting access token to token: %+v", err)
}
if !strings.Contains(accessToken.Resource, "management") {
log.Printf("[DEBUG] Resource %q isn't a management domain", accessToken.Resource)
continue
}
if !strings.HasSuffix(accessToken.Authority, tenantId) {
log.Printf("[DEBUG] Resource %q isn't for the correct Tenant", accessToken.Resource)
continue
}
validAccessToken := azureCliAccessToken{
ClientID: accessToken.ClientID,
AccessToken: &token,
}
return &validAccessToken, nil
}
return nil, fmt.Errorf("No Access Token was found for the Tenant ID %q", tenantId)
}

View File

@ -1,52 +0,0 @@
package authentication
import (
"strings"
"github.com/Azure/go-autorest/autorest/azure/cli"
)
type azureCLIProfile struct {
profile cli.Profile
clientId string
environment string
subscriptionId string
tenantId string
}
func (a *azureCLIProfile) populateFields() error {
// ensure we know the Subscription ID - since it's needed for everything else
if a.subscriptionId == "" {
err := a.populateSubscriptionID()
if err != nil {
return err
}
}
if a.tenantId == "" {
// now we know the subscription ID, find the associated Tenant ID
err := a.populateTenantID()
if err != nil {
return err
}
}
// always pull the environment from the Azure CLI, since the Access Token's associated with it
return a.populateEnvironment()
}
func (a *azureCLIProfile) verifyAuthenticatedAsAUser() bool {
for _, subscription := range a.profile.Subscriptions {
if subscription.User == nil {
continue
}
authenticatedAsAUser := strings.EqualFold(subscription.User.Type, "user")
if authenticatedAsAUser {
return true
}
}
return false
}

View File

@ -1,81 +0,0 @@
package authentication
import (
"fmt"
"strings"
"github.com/Azure/go-autorest/autorest/azure/cli"
)
func (a *azureCLIProfile) populateSubscriptionID() error {
subscriptionId, err := a.findDefaultSubscriptionId()
if err != nil {
return err
}
a.subscriptionId = subscriptionId
return nil
}
func (a *azureCLIProfile) populateTenantID() error {
subscription, err := a.findSubscription(a.subscriptionId)
if err != nil {
return err
}
a.tenantId = subscription.TenantID
return nil
}
func (a *azureCLIProfile) populateClientId() error {
// we can now pull out the ClientID and the Access Token to use from the Access Token
tokensPath, err := cli.AccessTokensPath()
if err != nil {
return fmt.Errorf("Error loading the Tokens Path from the Azure CLI: %+v", err)
}
tokens, err := cli.LoadTokens(tokensPath)
if err != nil {
return fmt.Errorf("No Authorization Tokens were found - please ensure the Azure CLI is installed and then log-in with `az login`.")
}
validToken, err := findValidAccessTokenForTenant(tokens, a.tenantId)
if err != nil {
return fmt.Errorf("No Authorization Tokens were found - please re-authenticate using `az login`.")
}
token := *validToken
a.clientId = token.ClientID
return nil
}
func (a *azureCLIProfile) populateEnvironment() error {
subscription, err := a.findSubscription(a.subscriptionId)
if err != nil {
return err
}
a.environment = normalizeEnvironmentName(subscription.EnvironmentName)
return nil
}
func (a azureCLIProfile) findDefaultSubscriptionId() (string, error) {
for _, subscription := range a.profile.Subscriptions {
if subscription.IsDefault {
return subscription.ID, nil
}
}
return "", fmt.Errorf("No Subscription was Marked as Default in the Azure Profile.")
}
func (a azureCLIProfile) findSubscription(subscriptionId string) (*cli.Subscription, error) {
for _, subscription := range a.profile.Subscriptions {
if strings.EqualFold(subscription.ID, subscriptionId) {
return &subscription, nil
}
}
return nil, fmt.Errorf("Subscription %q was not found in your Azure CLI credentials. Please verify it exists in `az account list`.", subscriptionId)
}

View File

@ -3,14 +3,13 @@ package authentication
import (
"context"
"fmt"
"github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac"
"github.com/hashicorp/go-azure-helpers/sender"
)
func buildServicePrincipalObjectIDFunc(c *Config) func(ctx context.Context) (string, error) {
return func(ctx context.Context) (string, error) {
env, err := DetermineEnvironment(c.Environment)
env, err := AzureEnvironmentByNameFromEndpoint(ctx, c.MetadataURL, c.Environment)
if err != nil {
return "", err
}

View File

@ -18,6 +18,7 @@ type Builder struct {
SubscriptionID string
TenantID string
Environment string
MetadataURL string
// Auxiliary tenant IDs used for multi tenant auth
SupportsAuxiliaryTenants bool
@ -54,6 +55,7 @@ func (b Builder) Build() (*Config, error) {
TenantID: b.TenantID,
AuxiliaryTenantIDs: b.AuxiliaryTenantIDs,
Environment: b.Environment,
MetadataURL: b.MetadataURL,
CustomResourceManagerEndpoint: b.CustomResourceManagerEndpoint,
}

View File

@ -18,6 +18,7 @@ type Config struct {
TenantID string
AuxiliaryTenantIDs []string
Environment string
MetadataURL string
GetAuthenticatedObjectID func(context.Context) (string, error)
AuthenticatedAsAServicePrincipal bool

View File

@ -1,12 +1,55 @@
package authentication
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/Azure/go-autorest/autorest/azure"
)
var environmentTranslationMap = map[string]azure.Environment{
"public": azure.PublicCloud,
"usgovernment": azure.USGovernmentCloud,
"german": azure.GermanCloud,
"china": azure.ChinaCloud,
}
type Environment struct {
Portal string `json:"portal"`
Authentication Authentication `json:"authentication"`
Media string `json:"media"`
GraphAudience string `json:"graphAudience"`
Graph string `json:"graph"`
Name string `json:"name"`
Suffixes Suffixes `json:"suffixes"`
Batch string `json:"batch"`
ResourceManager string `json:"resourceManager"`
VmImageAliasDoc string `json:"vmImageAliasDoc"`
ActiveDirectoryDataLake string `json:"activeDirectoryDataLake"`
SqlManagement string `json:"sqlManagement"`
Gallery string `json:"gallery"`
}
type Authentication struct {
LoginEndpoint string `json:"loginEndpoint"`
Audiences []string `json:"audiences"`
Tenant string `json:"tenant"`
IdentityProvider string `json:"identityProvider"`
}
type Suffixes struct {
AzureDataLakeStoreFileSystem string `json:"azureDataLakeStoreFileSystem"`
AcrLoginServer string `json:"acrLoginServer"`
SqlServerHostname string `json:"sqlServerHostname"`
AzureDataLakeAnalyticsCatalogAndJob string `json:"azureDataLakeAnalyticsCatalogAndJob"`
KeyVaultDns string `json:"keyVaultDns"`
Storage string `json:"storage"`
AzureFrontDoorEndpointSuffix string `json:"azureFrontDoorEndpointSuffix"`
}
// DetermineEnvironment determines what the Environment name is within
// the Azure SDK for Go and then returns the association environment, if it exists.
func DetermineEnvironment(name string) (*azure.Environment, error) {
@ -53,3 +96,115 @@ func normalizeEnvironmentName(input string) string {
}
return output
}
// AzureEnvironmentByName returns a specific Azure Environment from the specified endpoint
func AzureEnvironmentByNameFromEndpoint(ctx context.Context, endpoint string, environmentName string) (*azure.Environment, error) {
if env, ok := environmentTranslationMap[strings.ToLower(environmentName)]; ok {
return &env, nil
}
if endpoint == "" {
return nil, fmt.Errorf("unable to locate metadata for environment %q from the built in `public`, `usgoverment`, `china` and no custom metadata host has been specified", environmentName)
}
environments, err := getSupportedEnvironments(ctx, endpoint)
if err != nil {
return nil, err
}
// while the array contains values
for _, env := range environments {
if strings.EqualFold(env.Name, environmentName) {
aEnv, err := buildAzureEnvironment(env)
if err != nil {
return nil, err
}
return aEnv, nil
}
}
return nil, fmt.Errorf("unable to locate metadata for environment %q from custom metadata host %q", environmentName, endpoint)
}
// IsEnvironmentAzureStack returns whether a specific Azure Environment is an Azure Stack environment
func IsEnvironmentAzureStack(ctx context.Context, endpoint string, environmentName string) (bool, error) {
if _, ok := environmentTranslationMap[strings.ToLower(environmentName)]; ok {
return false, nil
}
environments, err := getSupportedEnvironments(ctx, endpoint)
if err != nil {
return false, err
}
// while the array contains values
for _, env := range environments {
if err != nil {
return false, fmt.Errorf("unable to decode environment from %q response: %+v", endpoint, err)
}
if strings.EqualFold(env.Name, environmentName) {
if !strings.EqualFold(env.Authentication.IdentityProvider, "AAD") || !strings.EqualFold(env.Authentication.Tenant, "common") {
return true, nil
}
return false, nil
}
}
return false, fmt.Errorf("unable to find environment %q from endpoint %q", environmentName, endpoint)
}
func getSupportedEnvironments(ctx context.Context, endpoint string) ([]Environment, error) {
uri := fmt.Sprintf("https://%s/metadata/endpoints?api-version=2020-06-01", endpoint)
client := http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
},
}
req, err := http.NewRequestWithContext(ctx, "GET", uri, nil)
if err != nil {
return nil, err
}
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("retrieving environments from Azure MetaData service: %+v", err)
}
var environments []Environment
if err := json.NewDecoder(resp.Body).Decode(&environments); err != nil {
return nil, err
}
return environments, nil
}
func buildAzureEnvironment(env Environment) (*azure.Environment, error) {
aEnv := &azure.Environment{
Name: env.Name,
ResourceManagerEndpoint: env.ResourceManager,
StorageEndpointSuffix: env.Suffixes.Storage,
ActiveDirectoryEndpoint: env.Authentication.LoginEndpoint,
GraphEndpoint: env.Graph,
KeyVaultEndpoint: fmt.Sprintf("https://%s/", env.Suffixes.KeyVaultDns),
GalleryEndpoint: env.Gallery,
BatchManagementEndpoint: env.Batch,
SQLDatabaseDNSSuffix: env.Suffixes.SqlServerHostname,
KeyVaultDNSSuffix: env.Suffixes.KeyVaultDns,
ContainerRegistryDNSSuffix: env.Suffixes.AcrLoginServer,
ResourceIdentifiers: azure.ResourceIdentifier{
// This isn't returned from the metadata url and is universal across all environments
Storage: "https://storage.azure.com/",
Graph: env.Graph,
KeyVault: fmt.Sprintf("https://%s/", env.Suffixes.KeyVaultDns),
Datalake: env.ActiveDirectoryDataLake,
Batch: env.Batch,
},
}
if len(env.Authentication.Audiences) > 0 {
aEnv.TokenAudience = env.Authentication.Audiences[0]
} else {
return nil, fmt.Errorf("unable to find token audience for environment %q", env.Name)
}
return aEnv, nil
}

View File

@ -0,0 +1,45 @@
package blobs
import (
"context"
"os"
"time"
"github.com/Azure/go-autorest/autorest"
)
type StorageBlob interface {
AppendBlock(ctx context.Context, accountName, containerName, blobName string, input AppendBlockInput) (result AppendBlockResult, err error)
Copy(ctx context.Context, accountName, containerName, blobName string, input CopyInput) (result CopyResult, err error)
AbortCopy(ctx context.Context, accountName, containerName, blobName string, input AbortCopyInput) (result autorest.Response, err error)
CopyAndWait(ctx context.Context, accountName, containerName, blobName string, input CopyInput, pollingInterval time.Duration) error
Delete(ctx context.Context, accountName, containerName, blobName string, input DeleteInput) (result autorest.Response, err error)
DeleteSnapshot(ctx context.Context, accountName, containerName, blobName string, input DeleteSnapshotInput) (result autorest.Response, err error)
DeleteSnapshots(ctx context.Context, accountName, containerName, blobName string, input DeleteSnapshotsInput) (result autorest.Response, err error)
Get(ctx context.Context, accountName, containerName, blobName string, input GetInput) (result GetResult, err error)
GetBlockList(ctx context.Context, accountName, containerName, blobName string, input GetBlockListInput) (result GetBlockListResult, err error)
GetPageRanges(ctx context.Context, accountName, containerName, blobName string, input GetPageRangesInput) (result GetPageRangesResult, err error)
IncrementalCopyBlob(ctx context.Context, accountName, containerName, blobName string, input IncrementalCopyBlobInput) (result autorest.Response, err error)
AcquireLease(ctx context.Context, accountName, containerName, blobName string, input AcquireLeaseInput) (result AcquireLeaseResult, err error)
BreakLease(ctx context.Context, accountName, containerName, blobName string, input BreakLeaseInput) (result autorest.Response, err error)
ChangeLease(ctx context.Context, accountName, containerName, blobName string, input ChangeLeaseInput) (result ChangeLeaseResponse, err error)
ReleaseLease(ctx context.Context, accountName, containerName, blobName, leaseID string) (result autorest.Response, err error)
RenewLease(ctx context.Context, accountName, containerName, blobName, leaseID string) (result autorest.Response, err error)
SetMetaData(ctx context.Context, accountName, containerName, blobName string, input SetMetaDataInput) (result autorest.Response, err error)
GetProperties(ctx context.Context, accountName, containerName, blobName string, input GetPropertiesInput) (result GetPropertiesResult, err error)
SetProperties(ctx context.Context, accountName, containerName, blobName string, input SetPropertiesInput) (result SetPropertiesResult, err error)
PutAppendBlob(ctx context.Context, accountName, containerName, blobName string, input PutAppendBlobInput) (result autorest.Response, err error)
PutBlock(ctx context.Context, accountName, containerName, blobName string, input PutBlockInput) (result PutBlockResult, err error)
PutBlockBlob(ctx context.Context, accountName, containerName, blobName string, input PutBlockBlobInput) (result autorest.Response, err error)
PutBlockBlobFromFile(ctx context.Context, accountName, containerName, blobName string, file *os.File, input PutBlockBlobInput) error
PutBlockList(ctx context.Context, accountName, containerName, blobName string, input PutBlockListInput) (result PutBlockListResult, err error)
PutBlockFromURL(ctx context.Context, accountName, containerName, blobName string, input PutBlockFromURLInput) (result PutBlockFromURLResult, err error)
PutPageBlob(ctx context.Context, accountName, containerName, blobName string, input PutPageBlobInput) (result autorest.Response, err error)
PutPageClear(ctx context.Context, accountName, containerName, blobName string, input PutPageClearInput) (result autorest.Response, err error)
PutPageUpdate(ctx context.Context, accountName, containerName, blobName string, input PutPageUpdateInput) (result PutPageUpdateResult, err error)
GetResourceID(accountName, containerName, blobName string) string
SetTier(ctx context.Context, accountName, containerName, blobName string, tier AccessTier) (result autorest.Response, err error)
Snapshot(ctx context.Context, accountName, containerName, blobName string, input SnapshotInput) (result SnapshotResult, err error)
GetSnapshotProperties(ctx context.Context, accountName, containerName, blobName string, input GetSnapshotPropertiesInput) (result GetPropertiesResult, err error)
Undelete(ctx context.Context, accountName, containerName, blobName string) (result autorest.Response, err error)
}

View File

@ -0,0 +1,25 @@
package containers
import (
"context"
"github.com/Azure/go-autorest/autorest"
)
type StorageContainer interface {
Create(ctx context.Context, accountName, containerName string, input CreateInput) (result CreateResponse, err error)
Delete(ctx context.Context, accountName, containerName string) (result autorest.Response, err error)
GetProperties(ctx context.Context, accountName, containerName string) (ContainerProperties, error)
GetPropertiesWithLeaseID(ctx context.Context, accountName, containerName, leaseID string) (result ContainerProperties, err error)
AcquireLease(ctx context.Context, accountName, containerName string, input AcquireLeaseInput) (result AcquireLeaseResponse, err error)
BreakLease(ctx context.Context, accountName, containerName string, input BreakLeaseInput) (result BreakLeaseResponse, err error)
ChangeLease(ctx context.Context, accountName, containerName string, input ChangeLeaseInput) (result ChangeLeaseResponse, err error)
ReleaseLease(ctx context.Context, accountName, containerName, leaseID string) (result autorest.Response, err error)
RenewLease(ctx context.Context, accountName, containerName, leaseID string) (result autorest.Response, err error)
ListBlobs(ctx context.Context, accountName, containerName string, input ListBlobsInput) (result ListBlobsResult, err error)
GetResourceManagerResourceID(subscriptionID, resourceGroup, accountName, containerName string) string
SetAccessControl(ctx context.Context, accountName, containerName string, level AccessLevel) (autorest.Response, error)
SetAccessControlWithLeaseID(ctx context.Context, accountName, containerName, leaseID string, level AccessLevel) (result autorest.Response, err error)
SetMetaData(ctx context.Context, accountName, containerName string, metaData map[string]string) (autorest.Response, error)
SetMetaDataWithLeaseID(ctx context.Context, accountName, containerName, leaseID string, metaData map[string]string) (result autorest.Response, err error)
}

View File

@ -10,7 +10,7 @@ import (
"github.com/tombuildsstuff/giovanni/storage/internal/endpoints"
)
// RenewLease renewes the lock based on the Lease ID
// RenewLease renews the lock based on the Lease ID
func (client Client) RenewLease(ctx context.Context, accountName, containerName, leaseID string) (result autorest.Response, err error) {
if accountName == "" {
return result, validation.NewError("containers.Client", "RenewLease", "`accountName` cannot be an empty string.")

View File

@ -1,3 +1,3 @@
package version
const Number = "v0.10.1"
const Number = "v0.12.0"

View File

@ -36,7 +36,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
// during the authentication phase the client first attempts the "none" method
// then any untried methods suggested by the server.
tried := make(map[string]bool)
var tried []string
var lastMethods []string
sessionID := c.transport.getSessionID()
@ -49,7 +49,9 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
// success
return nil
} else if ok == authFailure {
tried[auth.method()] = true
if m := auth.method(); !contains(tried, m) {
tried = append(tried, m)
}
}
if methods == nil {
methods = lastMethods
@ -61,7 +63,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
findNext:
for _, a := range config.Auth {
candidateMethod := a.method()
if tried[candidateMethod] {
if contains(tried, candidateMethod) {
continue
}
for _, meth := range methods {
@ -72,16 +74,16 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error {
}
}
}
return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", keys(tried))
return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried)
}
func keys(m map[string]bool) []string {
s := make([]string, 0, len(m))
for key := range m {
s = append(s, key)
func contains(list []string, e string) bool {
for _, s := range list {
if s == e {
return true
}
}
return s
return false
}
// An AuthMethod represents an instance of an RFC 4252 authentication method.

30
vendor/modules.txt vendored
View File

@ -7,7 +7,7 @@ cloud.google.com/go/internal/optional
cloud.google.com/go/internal/trace
cloud.google.com/go/internal/version
cloud.google.com/go/storage
# github.com/Azure/azure-sdk-for-go v40.3.0+incompatible
# github.com/Azure/azure-sdk-for-go v45.0.0+incompatible
## explicit
github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/resources/mgmt/resources
github.com/Azure/azure-sdk-for-go/profiles/2017-03-09/storage/mgmt/storage
@ -15,23 +15,25 @@ github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac
github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2016-02-01/resources
github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2016-01-01/storage
github.com/Azure/azure-sdk-for-go/version
# github.com/Azure/go-autorest/autorest v0.10.0 => github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a
# github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest
# github.com/Azure/go-autorest/autorest v0.11.3
## explicit
github.com/Azure/go-autorest/autorest
github.com/Azure/go-autorest/autorest/azure
# github.com/Azure/go-autorest/autorest/adal v0.8.2
# github.com/Azure/go-autorest/autorest/adal v0.9.0
github.com/Azure/go-autorest/autorest/adal
# github.com/Azure/go-autorest/autorest/azure/cli v0.3.0
# github.com/Azure/go-autorest/autorest/azure/cli v0.4.0
github.com/Azure/go-autorest/autorest/azure/cli
# github.com/Azure/go-autorest/autorest/date v0.2.0
# github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/date
# github.com/Azure/go-autorest/autorest/to v0.3.0
# github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Azure/go-autorest/autorest/to
# github.com/Azure/go-autorest/autorest/validation v0.2.0
# github.com/Azure/go-autorest/autorest/validation v0.3.0
github.com/Azure/go-autorest/autorest/validation
# github.com/Azure/go-autorest/logger v0.1.0
# github.com/Azure/go-autorest/logger v0.2.0
github.com/Azure/go-autorest/logger
# github.com/Azure/go-autorest/tracing v0.5.0
# github.com/Azure/go-autorest/tracing v0.6.0
github.com/Azure/go-autorest/tracing
# github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c
## explicit
@ -318,7 +320,7 @@ github.com/hashicorp/consul/testutil/retry
# github.com/hashicorp/errwrap v1.0.0
## explicit
github.com/hashicorp/errwrap
# github.com/hashicorp/go-azure-helpers v0.10.0
# github.com/hashicorp/go-azure-helpers v0.12.0
## explicit
github.com/hashicorp/go-azure-helpers/authentication
github.com/hashicorp/go-azure-helpers/sender
@ -584,7 +586,7 @@ github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag/v20180813
github.com/tencentyun/cos-go-sdk-v5
# github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6
## explicit
# github.com/tombuildsstuff/giovanni v0.10.1
# github.com/tombuildsstuff/giovanni v0.12.0
## explicit
github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/blobs
github.com/tombuildsstuff/giovanni/storage/2018-11-09/blob/containers
@ -647,7 +649,7 @@ go.opencensus.io/trace/tracestate
## explicit
# go.uber.org/zap v1.9.1
## explicit
# golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
# golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
## explicit
golang.org/x/crypto/bcrypt
golang.org/x/crypto/blowfish
@ -963,8 +965,4 @@ k8s.io/utils/integer
k8s.io/utils/pointer
# sigs.k8s.io/yaml v1.1.0
sigs.k8s.io/yaml
# github.com/Azure/go-autorest v11.1.2+incompatible => github.com/Azure/go-autorest v12.1.0+incompatible
# k8s.io/client-go => k8s.io/client-go v0.0.0-20190620085101-78d2af792bab
# github.com/Azure/go-autorest => github.com/tombuildsstuff/go-autorest v14.0.1-0.20200416184303-d4e299a3c04a+incompatible
# github.com/Azure/go-autorest/autorest => github.com/tombuildsstuff/go-autorest/autorest v0.10.1-0.20200416184303-d4e299a3c04a
# github.com/Azure/go-autorest/autorest/azure/auth => github.com/tombuildsstuff/go-autorest/autorest/azure/auth v0.4.3-0.20200416184303-d4e299a3c04a