diff --git a/go.mod b/go.mod
index 25d12dcdb9..86b53e3055 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.16
require (
github.com/Azure/azure-sdk-for-go v55.8.0+incompatible
- github.com/Azure/go-autorest/autorest v0.11.21
+ github.com/Azure/go-autorest/autorest v0.11.22
github.com/Azure/go-autorest/autorest/adal v0.9.16
github.com/Azure/go-autorest/autorest/date v0.3.0
github.com/Azure/go-autorest/autorest/to v0.4.0
@@ -22,11 +22,11 @@ require (
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
google.golang.org/grpc v1.38.0
google.golang.org/protobuf v1.26.0
- k8s.io/api v0.22.3
- k8s.io/apimachinery v0.22.3
- k8s.io/client-go v0.22.3
- k8s.io/cloud-provider v0.22.2
- k8s.io/component-base v0.22.3
+ k8s.io/api v0.22.4
+ k8s.io/apimachinery v0.22.4
+ k8s.io/client-go v0.22.4
+ k8s.io/cloud-provider v0.22.3
+ k8s.io/component-base v0.22.4
k8s.io/klog/v2 v2.10.0
k8s.io/kubernetes v1.21.1
k8s.io/mount-utils v0.0.0
@@ -68,5 +68,5 @@ replace (
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.21.0
k8s.io/sample-controller => k8s.io/sample-controller v0.21.0
- sigs.k8s.io/cloud-provider-azure => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211112065827-1353b97f4161
+ sigs.k8s.io/cloud-provider-azure => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211122060509-bb8d775d86d1
)
diff --git a/go.sum b/go.sum
index 8d81be560f..9ead1be16f 100644
--- a/go.sum
+++ b/go.sum
@@ -48,8 +48,8 @@ github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.9.0/go.mod h1:xyHB1BMZT0cuDHU7I0+g046+BFDTQ8rEZB0s4Yfa6bI=
github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw=
-github.com/Azure/go-autorest/autorest v0.11.21 h1:w77zY/9RnUAWcIQyDC0Fc89mCvwftR8F+zsR/OH6enk=
-github.com/Azure/go-autorest/autorest v0.11.21/go.mod h1:Do/yuMSW/13ayUkcVREpsMHGG+MvV81uzSCFgYPj4tM=
+github.com/Azure/go-autorest/autorest v0.11.22 h1:bXiQwDjrRmBQOE67bwlvUKAC1EU1yZTPQ38c+bstZws=
+github.com/Azure/go-autorest/autorest v0.11.22/go.mod h1:BAWYUWGPEtKPzjVkp0Q6an0MJcJDsoh5Z1BFAEFs4Xs=
github.com/Azure/go-autorest/autorest/adal v0.5.0/go.mod h1:8Z9fGy2MpX0PvDjB1pEgQTmVqjGhiHBW7RJJEciWzS0=
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
@@ -205,8 +205,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
-github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c=
-github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko=
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
@@ -333,8 +331,6 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
github.com/godbus/dbus v0.0.0-20181101234600-2ff6f7ffd60f/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
-github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw=
-github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
@@ -612,7 +608,6 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
-github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
github.com/mohae/deepcopy v0.0.0-20170603005431-491d3605edfb/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
@@ -708,7 +703,6 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
-github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021 h1:if3/24+h9Sq6eDx8UUz1SO9cT9tizyIsATfB7b4D3tc=
github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021/go.mod h1:DM5xW0nvfNNm2uytzsvhI3OnX8uzaRAg8UX/CnDqbto=
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
@@ -863,8 +857,9 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
-golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1071,6 +1066,7 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@@ -1399,8 +1395,8 @@ rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15 h1:4uqm9Mv+w2MmBYD+F4qf/v6tDFUdPOk29C095RbU5mY=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
-sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211112065827-1353b97f4161 h1:BiTIfbPQ1ggHgr49nO4bvjAWpnXgFILqxOWzW+b2Igw=
-sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211112065827-1353b97f4161/go.mod h1:F7Lb6NRY/O8h4Ignbl82OilqC3CwdWpoD3RPl4OaMv0=
+sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211122060509-bb8d775d86d1 h1:8MntCWj92pyk11LDk3cgd63UgZc12YmKEsMXHe+6CVs=
+sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211122060509-bb8d775d86d1/go.mod h1:O2VB2oGJSUohYWZWwV9kIpiInJzSwpq+zRPoWrq/IFo=
sigs.k8s.io/kustomize v2.0.3+incompatible/go.mod h1:MkjgH3RdOWrievjo6c9T245dYlB5QeXV4WCbnt/PEpU=
sigs.k8s.io/kustomize/api v0.8.5/go.mod h1:M377apnKT5ZHJS++6H4rQoCHmWtt6qTpp3mbe7p6OLY=
sigs.k8s.io/kustomize/cmd/config v0.9.7/go.mod h1:MvXCpHs77cfyxRmCNUQjIqCmZyYsbn5PyQpWiq44nW0=
diff --git a/pkg/azuredisk/azure_dd_max_disk_count.go b/pkg/azuredisk/azure_dd_max_disk_count.go
index 73b901a5d5..14e40665d2 100644
--- a/pkg/azuredisk/azure_dd_max_disk_count.go
+++ b/pkg/azuredisk/azure_dd_max_disk_count.go
@@ -19,615 +19,652 @@ package azuredisk
// about how to get all VM size list,
// refer to https://github.com/kubernetes/kubernetes/issues/77461#issuecomment-492488756
var maxDataDiskCountMap = map[string]int64{
- "BASIC_A0": 1,
- "BASIC_A1": 2,
- "BASIC_A2": 4,
- "BASIC_A3": 8,
- "BASIC_A4": 16,
- "STANDARD_A0": 1,
- "STANDARD_A10": 32,
- "STANDARD_A11": 64,
- "STANDARD_A1": 2,
- "STANDARD_A1_V2": 2,
- "STANDARD_A2": 4,
- "STANDARD_A2M_V2": 4,
- "STANDARD_A2_V2": 4,
- "STANDARD_A3": 8,
- "STANDARD_A4": 16,
- "STANDARD_A4M_V2": 8,
- "STANDARD_A4_V2": 8,
- "STANDARD_A5": 4,
- "STANDARD_A6": 8,
- "STANDARD_A7": 16,
- "STANDARD_A8": 32,
- "STANDARD_A8M_V2": 16,
- "STANDARD_A8_V2": 16,
- "STANDARD_A9": 64,
- "STANDARD_B12MS": 16,
- "STANDARD_B16MS": 32,
- "STANDARD_B1LS": 2,
- "STANDARD_B1MS": 2,
- "STANDARD_B1S": 2,
- "STANDARD_B20MS": 32,
- "STANDARD_B2MS": 4,
- "STANDARD_B2S": 4,
- "STANDARD_B4MS": 8,
- "STANDARD_B8MS": 16,
- "STANDARD_D11": 8,
- "STANDARD_D11_V2": 8,
- "STANDARD_D11_V2_PROMO": 8,
- "STANDARD_D12": 16,
- "STANDARD_D12_V2": 16,
- "STANDARD_D12_V2_PROMO": 16,
- "STANDARD_D13": 32,
- "STANDARD_D13_V2": 32,
- "STANDARD_D13_V2_PROMO": 32,
- "STANDARD_D1": 4,
- "STANDARD_D14": 64,
- "STANDARD_D14_V2": 64,
- "STANDARD_D14_V2_PROMO": 64,
- "STANDARD_D15_V2": 64,
- "STANDARD_D16ADS_V5": 32,
- "STANDARD_D16AS_V4": 32,
- "STANDARD_D16AS_V5": 32,
- "STANDARD_D16A_V4": 32,
- "STANDARD_D16DS_V4": 32,
- "STANDARD_D16DS_V5": 32,
- "STANDARD_D16D_V4": 32,
- "STANDARD_D16D_V5": 32,
- "STANDARD_D16S_V3": 32,
- "STANDARD_D16S_V4": 32,
- "STANDARD_D16S_V5": 32,
- "STANDARD_D16_V3": 32,
- "STANDARD_D16_V4": 32,
- "STANDARD_D16_V5": 32,
- "STANDARD_D1_V2": 4,
- "STANDARD_D2": 8,
- "STANDARD_D2ADS_V5": 4,
- "STANDARD_D2AS_V4": 4,
- "STANDARD_D2AS_V5": 4,
- "STANDARD_D2A_V4": 4,
- "STANDARD_D2DS_V4": 4,
- "STANDARD_D2DS_V5": 4,
- "STANDARD_D2D_V4": 4,
- "STANDARD_D2D_V5": 4,
- "STANDARD_D2S_V3": 4,
- "STANDARD_D2S_V4": 4,
- "STANDARD_D2S_V5": 4,
- "STANDARD_D2_V2": 8,
- "STANDARD_D2_V2_PROMO": 8,
- "STANDARD_D2_V3": 4,
- "STANDARD_D2_V4": 4,
- "STANDARD_D2_V5": 4,
- "STANDARD_D3": 16,
- "STANDARD_D32ADS_V5": 32,
- "STANDARD_D32AS_V4": 32,
- "STANDARD_D32AS_V5": 32,
- "STANDARD_D32A_V4": 32,
- "STANDARD_D32DS_V4": 32,
- "STANDARD_D32DS_V5": 32,
- "STANDARD_D32D_V4": 32,
- "STANDARD_D32D_V5": 32,
- "STANDARD_D32S_V3": 32,
- "STANDARD_D32S_V4": 32,
- "STANDARD_D32S_V5": 32,
- "STANDARD_D32_V3": 32,
- "STANDARD_D32_V4": 32,
- "STANDARD_D32_V5": 32,
- "STANDARD_D3_V2": 16,
- "STANDARD_D3_V2_PROMO": 16,
- "STANDARD_D4": 32,
- "STANDARD_D48ADS_V5": 32,
- "STANDARD_D48AS_V4": 32,
- "STANDARD_D48AS_V5": 32,
- "STANDARD_D48A_V4": 32,
- "STANDARD_D48DS_V4": 32,
- "STANDARD_D48DS_V5": 32,
- "STANDARD_D48D_V4": 32,
- "STANDARD_D48D_V5": 32,
- "STANDARD_D48S_V3": 32,
- "STANDARD_D48S_V4": 32,
- "STANDARD_D48S_V5": 32,
- "STANDARD_D48_V3": 32,
- "STANDARD_D48_V4": 32,
- "STANDARD_D48_V5": 32,
- "STANDARD_D4ADS_V5": 8,
- "STANDARD_D4AS_V4": 8,
- "STANDARD_D4AS_V5": 8,
- "STANDARD_D4A_V4": 8,
- "STANDARD_D4DS_V4": 8,
- "STANDARD_D4DS_V5": 8,
- "STANDARD_D4D_V4": 8,
- "STANDARD_D4D_V5": 8,
- "STANDARD_D4S_V3": 8,
- "STANDARD_D4S_V4": 8,
- "STANDARD_D4S_V5": 8,
- "STANDARD_D4_V2": 32,
- "STANDARD_D4_V2_PROMO": 32,
- "STANDARD_D4_V3": 8,
- "STANDARD_D4_V4": 8,
- "STANDARD_D4_V5": 8,
- "STANDARD_D5_V2": 64,
- "STANDARD_D5_V2_PROMO": 64,
- "STANDARD_D64ADS_V5": 32,
- "STANDARD_D64AS_V4": 32,
- "STANDARD_D64AS_V5": 32,
- "STANDARD_D64A_V4": 32,
- "STANDARD_D64DS_V4": 32,
- "STANDARD_D64DS_V5": 32,
- "STANDARD_D64D_V4": 32,
- "STANDARD_D64D_V5": 32,
- "STANDARD_D64S_V3": 32,
- "STANDARD_D64S_V4": 32,
- "STANDARD_D64S_V5": 32,
- "STANDARD_D64_V3": 32,
- "STANDARD_D64_V4": 32,
- "STANDARD_D64_V5": 32,
- "STANDARD_D8ADS_V5": 16,
- "STANDARD_D8AS_V4": 16,
- "STANDARD_D8AS_V5": 16,
- "STANDARD_D8A_V4": 16,
- "STANDARD_D8DS_V4": 16,
- "STANDARD_D8DS_V5": 16,
- "STANDARD_D8D_V4": 16,
- "STANDARD_D8D_V5": 16,
- "STANDARD_D8S_V3": 16,
- "STANDARD_D8S_V4": 16,
- "STANDARD_D8S_V5": 16,
- "STANDARD_D8_V3": 16,
- "STANDARD_D8_V4": 16,
- "STANDARD_D8_V5": 16,
- "STANDARD_D96ADS_V5": 32,
- "STANDARD_D96AS_V4": 32,
- "STANDARD_D96AS_V5": 32,
- "STANDARD_D96A_V4": 32,
- "STANDARD_DC16DMS_V3": 32,
- "STANDARD_DC16MS_V3": 32,
- "STANDARD_DC1DMS_V3": 4,
- "STANDARD_DC1MS_V3": 4,
- "STANDARD_D96DS_V5": 32,
- "STANDARD_D96D_V5": 32,
- "STANDARD_D96S_V5": 32,
- "STANDARD_D96_V5": 32,
- "STANDARD_DC16DS_V3": 32,
- "STANDARD_DC16S_V3": 32,
- "STANDARD_DC1DS_V3": 4,
- "STANDARD_DC1S_V2": 1,
- "STANDARD_DC24DMS_V3": 32,
- "STANDARD_DC24MS_V3": 32,
- "STANDARD_DC2DMS_V3": 8,
- "STANDARD_DC2MS_V3": 8,
- "STANDARD_DC1S_V3": 4,
- "STANDARD_DC24DS_V3": 32,
- "STANDARD_DC24S_V3": 32,
- "STANDARD_DC2DS_V3": 8,
- "STANDARD_DC2S": 2,
- "STANDARD_DC2S_V2": 2,
- "STANDARD_DC32DMS_V3": 32,
- "STANDARD_DC32MS_V3": 32,
- "STANDARD_DC4DMS_V3": 16,
- "STANDARD_DC4MS_V3": 16,
- "STANDARD_DC2S_V3": 8,
- "STANDARD_DC32DS_V3": 32,
- "STANDARD_DC32S_V3": 32,
- "STANDARD_DC48DS_V3": 32,
- "STANDARD_DC48S_V3": 32,
- "STANDARD_DC4DS_V3": 16,
- "STANDARD_DC4S": 4,
- "STANDARD_DC4S_V2": 4,
- "STANDARD_DC8DMS_V3": 32,
- "STANDARD_DC8MS_V3": 32,
- "STANDARD_DC8S": 8,
- "STANDARD_DC4S_V3": 16,
- "STANDARD_DC8DS_V3": 32,
- "STANDARD_DC8S_V3": 32,
- "STANDARD_DC8_V2": 8,
- "STANDARD_DS11-1_V2": 8,
- "STANDARD_DS11": 8,
- "STANDARD_DS11_V2": 8,
- "STANDARD_DS11_V2_PROMO": 8,
- "STANDARD_DS12": 16,
- "STANDARD_DS12-1_V2": 16,
- "STANDARD_DS12-2_V2": 16,
- "STANDARD_DS12_V2": 16,
- "STANDARD_DS12_V2_PROMO": 16,
- "STANDARD_DS13-2_V2": 32,
- "STANDARD_DS13": 32,
- "STANDARD_DS13-4_V2": 32,
- "STANDARD_DS13_V2": 32,
- "STANDARD_DS13_V2_PROMO": 32,
- "STANDARD_DS1": 4,
- "STANDARD_DS14-4_V2": 64,
- "STANDARD_DS14": 64,
- "STANDARD_DS14-8_V2": 64,
- "STANDARD_DS14_V2": 64,
- "STANDARD_DS14_V2_PROMO": 64,
- "STANDARD_DS15_V2": 64,
- "STANDARD_DS1_V2": 4,
- "STANDARD_DS2": 8,
- "STANDARD_DS2_V2": 8,
- "STANDARD_DS2_V2_PROMO": 8,
- "STANDARD_DS3": 16,
- "STANDARD_DS3_V2": 16,
- "STANDARD_DS3_V2_PROMO": 16,
- "STANDARD_DS4": 32,
- "STANDARD_DS4_V2": 32,
- "STANDARD_DS4_V2_PROMO": 32,
- "STANDARD_DS5_V2": 64,
- "STANDARD_DS5_V2_PROMO": 64,
- "STANDARD_E104IDS_V5": 64,
- "STANDARD_E104ID_V5": 64,
- "STANDARD_E104IS_V5": 64,
- "STANDARD_E104I_V5": 64,
- "STANDARD_E16-4ADS_V5": 32,
- "STANDARD_E16-4AS_V4": 32,
- "STANDARD_E16-4AS_V5": 32,
- "STANDARD_E16-4DS_V4": 32,
- "STANDARD_E16-4DS_V5": 32,
- "STANDARD_E16-4S_V3": 32,
- "STANDARD_E16-4S_V4": 32,
- "STANDARD_E16-4S_V5": 32,
- "STANDARD_E16-8ADS_V5": 32,
- "STANDARD_E16-8AS_V4": 32,
- "STANDARD_E16-8AS_V5": 32,
- "STANDARD_E16-8DS_V4": 32,
- "STANDARD_E16-8DS_V5": 32,
- "STANDARD_E16-8S_V3": 32,
- "STANDARD_E16-8S_V4": 32,
- "STANDARD_E16-8S_V5": 32,
- "STANDARD_E16ADS_V5": 32,
- "STANDARD_E16AS_V4": 32,
- "STANDARD_E16AS_V5": 32,
- "STANDARD_E16A_V4": 32,
- "STANDARD_E16DS_V4": 32,
- "STANDARD_E16DS_V5": 32,
- "STANDARD_E16D_V4": 32,
- "STANDARD_E16D_V5": 32,
- "STANDARD_E16S_V3": 32,
- "STANDARD_E16S_V4": 32,
- "STANDARD_E16S_V5": 32,
- "STANDARD_E16_V3": 32,
- "STANDARD_E16_V4": 32,
- "STANDARD_E16_V5": 32,
- "STANDARD_E20ADS_V5": 32,
- "STANDARD_E20AS_V4": 32,
- "STANDARD_E20AS_V5": 32,
- "STANDARD_E20A_V4": 32,
- "STANDARD_E20DS_V4": 32,
- "STANDARD_E20DS_V5": 32,
- "STANDARD_E20D_V4": 32,
- "STANDARD_E20D_V5": 32,
- "STANDARD_E20S_V3": 32,
- "STANDARD_E20S_V4": 32,
- "STANDARD_E20S_V5": 32,
- "STANDARD_E20_V3": 32,
- "STANDARD_E20_V4": 32,
- "STANDARD_E20_V5": 32,
- "STANDARD_E2ADS_V5": 4,
- "STANDARD_E2AS_V4": 4,
- "STANDARD_E2AS_V5": 4,
- "STANDARD_E2A_V4": 4,
- "STANDARD_E2DS_V4": 4,
- "STANDARD_E2DS_V5": 4,
- "STANDARD_E2D_V4": 4,
- "STANDARD_E2D_V5": 4,
- "STANDARD_E2S_V3": 4,
- "STANDARD_E2S_V4": 4,
- "STANDARD_E2S_V5": 4,
- "STANDARD_E2_V3": 4,
- "STANDARD_E2_V4": 4,
- "STANDARD_E2_V5": 4,
- "STANDARD_E32-16ADS_V5": 32,
- "STANDARD_E32-16AS_V4": 32,
- "STANDARD_E32-16AS_V5": 32,
- "STANDARD_E32-16DS_V4": 32,
- "STANDARD_E32-16DS_V5": 32,
- "STANDARD_E32-16S_V3": 32,
- "STANDARD_E32-16S_V4": 32,
- "STANDARD_E32-16S_V5": 32,
- "STANDARD_E32-8ADS_V5": 32,
- "STANDARD_E32-8AS_V4": 32,
- "STANDARD_E32-8AS_V5": 32,
- "STANDARD_E32-8DS_V4": 32,
- "STANDARD_E32-8DS_V5": 32,
- "STANDARD_E32-8S_V3": 32,
- "STANDARD_E32-8S_V4": 32,
- "STANDARD_E32-8S_V5": 32,
- "STANDARD_E32ADS_V5": 32,
- "STANDARD_E32AS_V4": 32,
- "STANDARD_E32AS_V5": 32,
- "STANDARD_E32A_V4": 32,
- "STANDARD_E32DS_V4": 32,
- "STANDARD_E32DS_V5": 32,
- "STANDARD_E32D_V4": 32,
- "STANDARD_E32D_V5": 32,
- "STANDARD_E32S_V3": 32,
- "STANDARD_E32S_V4": 32,
- "STANDARD_E32S_V5": 32,
- "STANDARD_E32_V3": 32,
- "STANDARD_E32_V4": 32,
- "STANDARD_E32_V5": 32,
- "STANDARD_E4-2ADS_V5": 8,
- "STANDARD_E4-2AS_V4": 8,
- "STANDARD_E4-2AS_V5": 8,
- "STANDARD_E4-2DS_V4": 8,
- "STANDARD_E4-2DS_V5": 8,
- "STANDARD_E4-2S_V3": 8,
- "STANDARD_E4-2S_V4": 8,
- "STANDARD_E4-2S_V5": 8,
- "STANDARD_E48ADS_V5": 32,
- "STANDARD_E48AS_V4": 32,
- "STANDARD_E48AS_V5": 32,
- "STANDARD_E48A_V4": 32,
- "STANDARD_E48DS_V4": 32,
- "STANDARD_E48DS_V5": 32,
- "STANDARD_E48D_V4": 32,
- "STANDARD_E48D_V5": 32,
- "STANDARD_E48S_V3": 32,
- "STANDARD_E48S_V4": 32,
- "STANDARD_E48S_V5": 32,
- "STANDARD_E48_V3": 32,
- "STANDARD_E48_V4": 32,
- "STANDARD_E48_V5": 32,
- "STANDARD_E4ADS_V5": 8,
- "STANDARD_E4AS_V4": 8,
- "STANDARD_E4AS_V5": 8,
- "STANDARD_E4A_V4": 8,
- "STANDARD_E4DS_V4": 8,
- "STANDARD_E4DS_V5": 8,
- "STANDARD_E4D_V4": 8,
- "STANDARD_E4D_V5": 8,
- "STANDARD_E4S_V3": 8,
- "STANDARD_E4S_V4": 8,
- "STANDARD_E4S_V5": 8,
- "STANDARD_E4_V3": 8,
- "STANDARD_E4_V4": 8,
- "STANDARD_E4_V5": 8,
- "STANDARD_E64-16ADS_V5": 32,
- "STANDARD_E64-16AS_V4": 32,
- "STANDARD_E64-16AS_V5": 32,
- "STANDARD_E64-16DS_V4": 32,
- "STANDARD_E64-16DS_V5": 32,
- "STANDARD_E64-16S_V3": 32,
- "STANDARD_E64-16S_V4": 32,
- "STANDARD_E64-16S_V5": 32,
- "STANDARD_E64-32ADS_V5": 32,
- "STANDARD_E64-32AS_V4": 32,
- "STANDARD_E64-32AS_V5": 32,
- "STANDARD_E64-32DS_V4": 32,
- "STANDARD_E64-32DS_V5": 32,
- "STANDARD_E64-32S_V3": 32,
- "STANDARD_E64-32S_V4": 32,
- "STANDARD_E64-32S_V5": 32,
- "STANDARD_E64ADS_V5": 32,
- "STANDARD_E64AS_V4": 32,
- "STANDARD_E64AS_V5": 32,
- "STANDARD_E64A_V4": 32,
- "STANDARD_E64DS_V4": 32,
- "STANDARD_E64DS_V5": 32,
- "STANDARD_E64D_V4": 32,
- "STANDARD_E64D_V5": 32,
- "STANDARD_E64IS_V3": 32,
- "STANDARD_E64I_V3": 32,
- "STANDARD_E64S_V3": 32,
- "STANDARD_E64S_V4": 32,
- "STANDARD_E64S_V5": 32,
- "STANDARD_E64_V3": 32,
- "STANDARD_E64_V4": 32,
- "STANDARD_E64_V5": 32,
- "STANDARD_E80IDS_V4": 64,
- "STANDARD_E80IS_V4": 64,
- "STANDARD_E8-2ADS_V5": 16,
- "STANDARD_E8-2AS_V4": 16,
- "STANDARD_E8-2AS_V5": 16,
- "STANDARD_E8-2DS_V4": 16,
- "STANDARD_E8-2DS_V5": 16,
- "STANDARD_E8-2S_V3": 16,
- "STANDARD_E8-2S_V4": 16,
- "STANDARD_E8-2S_V5": 16,
- "STANDARD_E8-4ADS_V5": 16,
- "STANDARD_E8-4AS_V4": 16,
- "STANDARD_E8-4AS_V5": 16,
- "STANDARD_E8-4DS_V4": 16,
- "STANDARD_E8-4DS_V5": 32,
- "STANDARD_E8-4S_V3": 16,
- "STANDARD_E8-4S_V4": 16,
- "STANDARD_E8-4S_V5": 32,
- "STANDARD_E8ADS_V5": 16,
- "STANDARD_E8AS_V4": 16,
- "STANDARD_E8AS_V5": 16,
- "STANDARD_E8A_V4": 16,
- "STANDARD_E8DS_V4": 16,
- "STANDARD_E8DS_V5": 16,
- "STANDARD_E8D_V4": 16,
- "STANDARD_E8D_V5": 16,
- "STANDARD_E8S_V3": 16,
- "STANDARD_E8S_V4": 16,
- "STANDARD_E8S_V5": 16,
- "STANDARD_E8_V3": 16,
- "STANDARD_E8_V4": 16,
- "STANDARD_E8_V5": 16,
- "STANDARD_E96-24ADS_V5": 32,
- "STANDARD_E96-24AS_V4": 32,
- "STANDARD_E96-24AS_V5": 32,
- "STANDARD_E96-24DS_V5": 32,
- "STANDARD_E96-24S_V5": 32,
- "STANDARD_E96-48ADS_V5": 32,
- "STANDARD_E96-48AS_V4": 32,
- "STANDARD_E96-48AS_V5": 32,
- "STANDARD_E96-48DS_V5": 32,
- "STANDARD_E96-48S_V5": 32,
- "STANDARD_E96ADS_V5": 32,
- "STANDARD_E96AS_V4": 32,
- "STANDARD_E96AS_V5": 32,
- "STANDARD_E96A_V4": 32,
- "STANDARD_E96DS_V5": 32,
- "STANDARD_E96D_V5": 32,
- "STANDARD_E96S_V5": 32,
- "STANDARD_E96_V5": 32,
- "STANDARD_F1": 4,
- "STANDARD_F16": 64,
- "STANDARD_F16S": 64,
- "STANDARD_F16S_V2": 32,
- "STANDARD_F1S": 4,
- "STANDARD_F2": 8,
- "STANDARD_F2S": 8,
- "STANDARD_F2S_V2": 4,
- "STANDARD_F32S_V2": 32,
- "STANDARD_F4": 16,
- "STANDARD_F48S_V2": 32,
- "STANDARD_F4S": 16,
- "STANDARD_F4S_V2": 8,
- "STANDARD_F64S_V2": 32,
- "STANDARD_F72S_V2": 32,
- "STANDARD_F8": 32,
- "STANDARD_F8S": 32,
- "STANDARD_F8S_V2": 16,
- "STANDARD_FX12MDS": 24,
- "STANDARD_FX24MDS": 32,
- "STANDARD_FX36MDS": 32,
- "STANDARD_FX48MDS": 32,
- "STANDARD_FX4MDS": 8,
- "STANDARD_G1": 8,
- "STANDARD_G2": 16,
- "STANDARD_G3": 32,
- "STANDARD_G4": 64,
- "STANDARD_G5": 64,
- "STANDARD_GS1": 8,
- "STANDARD_GS2": 16,
- "STANDARD_GS3": 32,
- "STANDARD_GS4-4": 64,
- "STANDARD_GS4": 64,
- "STANDARD_GS4-8": 64,
- "STANDARD_GS5-16": 64,
- "STANDARD_GS5": 64,
- "STANDARD_GS5-8": 64,
- "STANDARD_H16": 64,
- "STANDARD_H16M": 64,
- "STANDARD_H16M_PROMO": 64,
- "STANDARD_H16MR": 64,
- "STANDARD_H16MR_PROMO": 64,
- "STANDARD_H16_PROMO": 64,
- "STANDARD_H16R": 64,
- "STANDARD_H16R_PROMO": 64,
- "STANDARD_H8": 32,
- "STANDARD_H8M": 32,
- "STANDARD_H8M_PROMO": 32,
- "STANDARD_H8_PROMO": 32,
- "STANDARD_HB120-16RS_V3": 32,
- "STANDARD_HB120-32RS_V3": 32,
- "STANDARD_HB120-64RS_V3": 32,
- "STANDARD_HB120-96RS_V3": 32,
- "STANDARD_HB120RS_V2": 8,
- "STANDARD_HB120RS_V3": 32,
- "STANDARD_HB60-15RS": 4,
- "STANDARD_HB60-30RS": 4,
- "STANDARD_HB60-45RS": 4,
- "STANDARD_HB60RS": 4,
- "STANDARD_HC44-16RS": 4,
- "STANDARD_HC44-32RS": 4,
- "STANDARD_HC44RS": 4,
- "STANDARD_L16S": 64,
- "STANDARD_L16S_V2": 32,
- "STANDARD_L32S": 64,
- "STANDARD_L32S_V2": 32,
- "STANDARD_L48S_V2": 32,
- "STANDARD_L4S": 16,
- "STANDARD_L64S_V2": 32,
- "STANDARD_L80S_V2": 32,
- "STANDARD_L8S": 32,
- "STANDARD_L8S_V2": 16,
- "STANDARD_M128-32MS": 64,
- "STANDARD_M128": 64,
- "STANDARD_M128-64MS": 64,
- "STANDARD_M128DMS_V2": 64,
- "STANDARD_M128DS_V2": 64,
- "STANDARD_M128M": 64,
- "STANDARD_M128MS": 64,
- "STANDARD_M128MS_V2": 64,
- "STANDARD_M128S": 64,
- "STANDARD_M128S_V2": 64,
- "STANDARD_M16-4MS": 16,
- "STANDARD_M16-8MS": 16,
- "STANDARD_M16MS": 16,
- "STANDARD_M192IDMS_V2": 64,
- "STANDARD_M192IDS_V2": 64,
- "STANDARD_M192IMS_V2": 64,
- "STANDARD_M192IS_V2": 64,
- "STANDARD_M208MS_V2": 64,
- "STANDARD_M208S_V2": 64,
- "STANDARD_M32-16MS": 32,
- "STANDARD_M32-8MS": 32,
- "STANDARD_M32DMS_V2": 32,
- "STANDARD_M32LS": 32,
- "STANDARD_M32MS": 32,
- "STANDARD_M32MS_V2": 32,
- "STANDARD_M32TS": 32,
- "STANDARD_M416-208MS_V2": 64,
- "STANDARD_M416-208S_V2": 64,
- "STANDARD_M416MS_V2": 64,
- "STANDARD_M416S_V2": 64,
- "STANDARD_M64-16MS": 64,
- "STANDARD_M64-32MS": 64,
- "STANDARD_M64": 64,
- "STANDARD_M64DMS_V2": 64,
- "STANDARD_M64DS_V2": 64,
- "STANDARD_M64LS": 64,
- "STANDARD_M64M": 64,
- "STANDARD_M64MS": 64,
- "STANDARD_M64MS_V2": 64,
- "STANDARD_M64S": 64,
- "STANDARD_M64S_V2": 64,
- "STANDARD_M8-2MS": 8,
- "STANDARD_M832IXS": 64,
- "STANDARD_M8-4MS": 8,
- "STANDARD_M864IXS": 64,
- "STANDARD_M8MS": 8,
- "STANDARD_NC12": 48,
- "STANDARD_NC12_PROMO": 48,
- "STANDARD_NC12S_V2": 24,
- "STANDARD_NC12S_V3": 24,
- "STANDARD_NC16AS_T4_V3": 32,
- "STANDARD_NC24": 64,
- "STANDARD_NC24_PROMO": 64,
- "STANDARD_NC24R": 64,
- "STANDARD_NC24R_PROMO": 64,
- "STANDARD_NC24RS_V2": 32,
- "STANDARD_NC24RS_V3": 32,
- "STANDARD_NC24S_V2": 32,
- "STANDARD_NC24S_V3": 32,
- "STANDARD_NC4AS_T4_V3": 8,
- "STANDARD_NC6": 24,
- "STANDARD_NC64AS_T4_V3": 32,
- "STANDARD_NC6_PROMO": 24,
- "STANDARD_NC6S_V2": 12,
- "STANDARD_NC6S_V3": 12,
- "STANDARD_NC8AS_T4_V3": 16,
- "STANDARD_ND12S": 24,
- "STANDARD_ND24RS": 32,
- "STANDARD_ND24S": 32,
- "STANDARD_ND40RS_V2": 8,
- "STANDARD_ND40S_V3": 32,
- "STANDARD_ND6S": 12,
- "STANDARD_ND96ASR_V4": 16,
- "STANDARD_NP10S": 8,
- "STANDARD_NP20S": 16,
- "STANDARD_NP40S": 32,
- "STANDARD_NV12": 48,
- "STANDARD_NV12_PROMO": 48,
- "STANDARD_NV12S_V2": 24,
- "STANDARD_NV12S_V3": 12,
- "STANDARD_NV16AS_V4": 32,
- "STANDARD_NV24": 64,
- "STANDARD_NV24_PROMO": 64,
- "STANDARD_NV24S_V2": 32,
- "STANDARD_NV24S_V3": 24,
- "STANDARD_NV32AS_V4": 32,
- "STANDARD_NV48S_V3": 32,
- "STANDARD_NV4AS_V4": 8,
- "STANDARD_NV6": 24,
- "STANDARD_NV6_PROMO": 24,
- "STANDARD_NV6S_V2": 12,
- "STANDARD_NV8AS_V4": 16,
- "STANDARD_PB6S": 12,
+ "BASIC_A0": 1,
+ "BASIC_A1": 2,
+ "BASIC_A2": 4,
+ "BASIC_A3": 8,
+ "BASIC_A4": 16,
+ "STANDARD_A0": 1,
+ "STANDARD_A10": 32,
+ "STANDARD_A11": 64,
+ "STANDARD_A1": 2,
+ "STANDARD_A1_V2": 2,
+ "STANDARD_A2": 4,
+ "STANDARD_A2M_V2": 4,
+ "STANDARD_A2_V2": 4,
+ "STANDARD_A3": 8,
+ "STANDARD_A4": 16,
+ "STANDARD_A4M_V2": 8,
+ "STANDARD_A4_V2": 8,
+ "STANDARD_A5": 4,
+ "STANDARD_A6": 8,
+ "STANDARD_A7": 16,
+ "STANDARD_A8": 32,
+ "STANDARD_A8M_V2": 16,
+ "STANDARD_A8_V2": 16,
+ "STANDARD_A9": 64,
+ "STANDARD_B12MS": 16,
+ "STANDARD_B16MS": 32,
+ "STANDARD_B1LS": 2,
+ "STANDARD_B1MS": 2,
+ "STANDARD_B1S": 2,
+ "STANDARD_B20MS": 32,
+ "STANDARD_B2MS": 4,
+ "STANDARD_B2S": 4,
+ "STANDARD_B4MS": 8,
+ "STANDARD_B8MS": 16,
+ "STANDARD_D11": 8,
+ "STANDARD_D11_V2": 8,
+ "STANDARD_D11_V2_PROMO": 8,
+ "STANDARD_D12": 16,
+ "STANDARD_D12_V2": 16,
+ "STANDARD_D12_V2_PROMO": 16,
+ "STANDARD_D13": 32,
+ "STANDARD_D13_V2": 32,
+ "STANDARD_D13_V2_PROMO": 32,
+ "STANDARD_D1": 4,
+ "STANDARD_D14": 64,
+ "STANDARD_D14_V2": 64,
+ "STANDARD_D14_V2_PROMO": 64,
+ "STANDARD_D15_V2": 64,
+ "STANDARD_D16ADS_V5": 32,
+ "STANDARD_D16AS_V4": 32,
+ "STANDARD_D16AS_V5": 32,
+ "STANDARD_D16A_V4": 32,
+ "STANDARD_D16DS_V4": 32,
+ "STANDARD_D16DS_V5": 32,
+ "STANDARD_D16D_V4": 32,
+ "STANDARD_D16D_V5": 32,
+ "STANDARD_D16S_V3": 32,
+ "STANDARD_D16S_V4": 32,
+ "STANDARD_D16S_V5": 32,
+ "STANDARD_D16_V3": 32,
+ "STANDARD_D16_V4": 32,
+ "STANDARD_D16_V5": 32,
+ "STANDARD_D1_V2": 4,
+ "STANDARD_D2": 8,
+ "STANDARD_D2ADS_V5": 4,
+ "STANDARD_D2AS_V4": 4,
+ "STANDARD_D2AS_V5": 4,
+ "STANDARD_D2A_V4": 4,
+ "STANDARD_D2DS_V4": 4,
+ "STANDARD_D2DS_V5": 4,
+ "STANDARD_D2D_V4": 4,
+ "STANDARD_D2D_V5": 4,
+ "STANDARD_D2S_V3": 4,
+ "STANDARD_D2S_V4": 4,
+ "STANDARD_D2S_V5": 4,
+ "STANDARD_D2_V2": 8,
+ "STANDARD_D2_V2_PROMO": 8,
+ "STANDARD_D2_V3": 4,
+ "STANDARD_D2_V4": 4,
+ "STANDARD_D2_V5": 4,
+ "STANDARD_D3": 16,
+ "STANDARD_D32ADS_V5": 32,
+ "STANDARD_D32AS_V4": 32,
+ "STANDARD_D32AS_V5": 32,
+ "STANDARD_D32A_V4": 32,
+ "STANDARD_D32DS_V4": 32,
+ "STANDARD_D32DS_V5": 32,
+ "STANDARD_D32D_V4": 32,
+ "STANDARD_D32D_V5": 32,
+ "STANDARD_D32S_V3": 32,
+ "STANDARD_D32S_V4": 32,
+ "STANDARD_D32S_V5": 32,
+ "STANDARD_D32_V3": 32,
+ "STANDARD_D32_V4": 32,
+ "STANDARD_D32_V5": 32,
+ "STANDARD_D3_V2": 16,
+ "STANDARD_D3_V2_PROMO": 16,
+ "STANDARD_D4": 32,
+ "STANDARD_D48ADS_V5": 32,
+ "STANDARD_D48AS_V4": 32,
+ "STANDARD_D48AS_V5": 32,
+ "STANDARD_D48A_V4": 32,
+ "STANDARD_D48DS_V4": 32,
+ "STANDARD_D48DS_V5": 32,
+ "STANDARD_D48D_V4": 32,
+ "STANDARD_D48D_V5": 32,
+ "STANDARD_D48S_V3": 32,
+ "STANDARD_D48S_V4": 32,
+ "STANDARD_D48S_V5": 32,
+ "STANDARD_D48_V3": 32,
+ "STANDARD_D48_V4": 32,
+ "STANDARD_D48_V5": 32,
+ "STANDARD_D4ADS_V5": 8,
+ "STANDARD_D4AS_V4": 8,
+ "STANDARD_D4AS_V5": 8,
+ "STANDARD_D4A_V4": 8,
+ "STANDARD_D4DS_V4": 8,
+ "STANDARD_D4DS_V5": 8,
+ "STANDARD_D4D_V4": 8,
+ "STANDARD_D4D_V5": 8,
+ "STANDARD_D4S_V3": 8,
+ "STANDARD_D4S_V4": 8,
+ "STANDARD_D4S_V5": 8,
+ "STANDARD_D4_V2": 32,
+ "STANDARD_D4_V2_PROMO": 32,
+ "STANDARD_D4_V3": 8,
+ "STANDARD_D4_V4": 8,
+ "STANDARD_D4_V5": 8,
+ "STANDARD_D5_V2": 64,
+ "STANDARD_D5_V2_PROMO": 64,
+ "STANDARD_D64ADS_V5": 32,
+ "STANDARD_D64AS_V4": 32,
+ "STANDARD_D64AS_V5": 32,
+ "STANDARD_D64A_V4": 32,
+ "STANDARD_D64DS_V4": 32,
+ "STANDARD_D64DS_V5": 32,
+ "STANDARD_D64D_V4": 32,
+ "STANDARD_D64D_V5": 32,
+ "STANDARD_D64S_V3": 32,
+ "STANDARD_D64S_V4": 32,
+ "STANDARD_D64S_V5": 32,
+ "STANDARD_D64_V3": 32,
+ "STANDARD_D64_V4": 32,
+ "STANDARD_D64_V5": 32,
+ "STANDARD_D8ADS_V5": 16,
+ "STANDARD_D8AS_V4": 16,
+ "STANDARD_D8AS_V5": 16,
+ "STANDARD_D8A_V4": 16,
+ "STANDARD_D8DS_V4": 16,
+ "STANDARD_D8DS_V5": 16,
+ "STANDARD_D8D_V4": 16,
+ "STANDARD_D8D_V5": 16,
+ "STANDARD_D8S_V3": 16,
+ "STANDARD_D8S_V4": 16,
+ "STANDARD_D8S_V5": 16,
+ "STANDARD_D8_V3": 16,
+ "STANDARD_D8_V4": 16,
+ "STANDARD_D8_V5": 16,
+ "STANDARD_D96ADS_V5": 32,
+ "STANDARD_D96AS_V4": 32,
+ "STANDARD_D96AS_V5": 32,
+ "STANDARD_D96A_V4": 32,
+ "STANDARD_DC16DMS_V3": 32,
+ "STANDARD_DC16MS_V3": 32,
+ "STANDARD_DC1DMS_V3": 4,
+ "STANDARD_DC1MS_V3": 4,
+ "STANDARD_D96DS_V5": 32,
+ "STANDARD_D96D_V5": 32,
+ "STANDARD_D96S_V5": 32,
+ "STANDARD_D96_V5": 32,
+ "STANDARD_DC16ADS_V5": 32,
+ "STANDARD_DC16AS_V5": 32,
+ "STANDARD_DC16DS_V3": 32,
+ "STANDARD_DC16S_V3": 32,
+ "STANDARD_DC1DS_V3": 4,
+ "STANDARD_DC1S_V2": 1,
+ "STANDARD_DC24DMS_V3": 32,
+ "STANDARD_DC24MS_V3": 32,
+ "STANDARD_DC2DMS_V3": 8,
+ "STANDARD_DC2MS_V3": 8,
+ "STANDARD_DC1S_V3": 4,
+ "STANDARD_DC24DS_V3": 32,
+ "STANDARD_DC24S_V3": 32,
+ "STANDARD_DC2DS_V3": 8,
+ "STANDARD_DC2ADS_V5": 4,
+ "STANDARD_DC2AS_V5": 4,
+ "STANDARD_DC2S": 2,
+ "STANDARD_DC2S_V2": 2,
+ "STANDARD_DC32DMS_V3": 32,
+ "STANDARD_DC32MS_V3": 32,
+ "STANDARD_DC4DMS_V3": 16,
+ "STANDARD_DC4MS_V3": 16,
+ "STANDARD_DC2S_V3": 8,
+ "STANDARD_DC32ADS_V5": 32,
+ "STANDARD_DC32AS_V5": 32,
+ "STANDARD_DC32DS_V3": 32,
+ "STANDARD_DC32S_V3": 32,
+ "STANDARD_DC48ADS_V5": 32,
+ "STANDARD_DC48AS_V5": 32,
+ "STANDARD_DC48DS_V3": 32,
+ "STANDARD_DC48S_V3": 32,
+ "STANDARD_DC4ADS_V5": 8,
+ "STANDARD_DC4AS_V5": 8,
+ "STANDARD_DC4DS_V3": 16,
+ "STANDARD_DC4S": 4,
+ "STANDARD_DC4S_V2": 4,
+ "STANDARD_DC8DMS_V3": 32,
+ "STANDARD_DC8MS_V3": 32,
+ "STANDARD_DC8S": 8,
+ "STANDARD_DC4S_V3": 16,
+ "STANDARD_DC64ADS_V5": 32,
+ "STANDARD_DC64AS_V5": 32,
+ "STANDARD_DC8ADS_V5": 16,
+ "STANDARD_DC8AS_V5": 16,
+ "STANDARD_DC8DS_V3": 32,
+ "STANDARD_DC8S_V3": 32,
+ "STANDARD_DC8_V2": 8,
+ "STANDARD_DC96ADS_V5": 32,
+ "STANDARD_DC96AS_V5": 32,
+ "STANDARD_DS11-1_V2": 8,
+ "STANDARD_DS11": 8,
+ "STANDARD_DS11_V2": 8,
+ "STANDARD_DS11_V2_PROMO": 8,
+ "STANDARD_DS12": 16,
+ "STANDARD_DS12-1_V2": 16,
+ "STANDARD_DS12-2_V2": 16,
+ "STANDARD_DS12_V2": 16,
+ "STANDARD_DS12_V2_PROMO": 16,
+ "STANDARD_DS13-2_V2": 32,
+ "STANDARD_DS13": 32,
+ "STANDARD_DS13-4_V2": 32,
+ "STANDARD_DS13_V2": 32,
+ "STANDARD_DS13_V2_PROMO": 32,
+ "STANDARD_DS1": 4,
+ "STANDARD_DS14-4_V2": 64,
+ "STANDARD_DS14": 64,
+ "STANDARD_DS14-8_V2": 64,
+ "STANDARD_DS14_V2": 64,
+ "STANDARD_DS14_V2_PROMO": 64,
+ "STANDARD_DS15_V2": 64,
+ "STANDARD_DS1_V2": 4,
+ "STANDARD_DS2": 8,
+ "STANDARD_DS2_V2": 8,
+ "STANDARD_DS2_V2_PROMO": 8,
+ "STANDARD_DS3": 16,
+ "STANDARD_DS3_V2": 16,
+ "STANDARD_DS3_V2_PROMO": 16,
+ "STANDARD_DS4": 32,
+ "STANDARD_DS4_V2": 32,
+ "STANDARD_DS4_V2_PROMO": 32,
+ "STANDARD_DS5_V2": 64,
+ "STANDARD_DS5_V2_PROMO": 64,
+ "STANDARD_E104IDS_V5": 64,
+ "STANDARD_E104ID_V5": 64,
+ "STANDARD_E104IS_V5": 64,
+ "STANDARD_E104I_V5": 64,
+ "STANDARD_E16-4ADS_V5": 32,
+ "STANDARD_E16-4AS_V4": 32,
+ "STANDARD_E16-4AS_V5": 32,
+ "STANDARD_E16-4DS_V4": 32,
+ "STANDARD_E16-4DS_V5": 32,
+ "STANDARD_E16-4S_V3": 32,
+ "STANDARD_E16-4S_V4": 32,
+ "STANDARD_E16-4S_V5": 32,
+ "STANDARD_E16-8ADS_V5": 32,
+ "STANDARD_E16-8AS_V4": 32,
+ "STANDARD_E16-8AS_V5": 32,
+ "STANDARD_E16-8DS_V4": 32,
+ "STANDARD_E16-8DS_V5": 32,
+ "STANDARD_E16-8S_V3": 32,
+ "STANDARD_E16-8S_V4": 32,
+ "STANDARD_E16-8S_V5": 32,
+ "STANDARD_E16ADS_V5": 32,
+ "STANDARD_E16AS_V4": 32,
+ "STANDARD_E16AS_V5": 32,
+ "STANDARD_E16A_V4": 32,
+ "STANDARD_E16DS_V4": 32,
+ "STANDARD_E16DS_V5": 32,
+ "STANDARD_E16D_V4": 32,
+ "STANDARD_E16D_V5": 32,
+ "STANDARD_E16S_V3": 32,
+ "STANDARD_E16S_V4": 32,
+ "STANDARD_E16S_V5": 32,
+ "STANDARD_E16_V3": 32,
+ "STANDARD_E16_V4": 32,
+ "STANDARD_E16_V5": 32,
+ "STANDARD_E20ADS_V5": 32,
+ "STANDARD_E20AS_V4": 32,
+ "STANDARD_E20AS_V5": 32,
+ "STANDARD_E20A_V4": 32,
+ "STANDARD_E20DS_V4": 32,
+ "STANDARD_E20DS_V5": 32,
+ "STANDARD_E20D_V4": 32,
+ "STANDARD_E20D_V5": 32,
+ "STANDARD_E20S_V3": 32,
+ "STANDARD_E20S_V4": 32,
+ "STANDARD_E20S_V5": 32,
+ "STANDARD_E20_V3": 32,
+ "STANDARD_E20_V4": 32,
+ "STANDARD_E20_V5": 32,
+ "STANDARD_E2ADS_V5": 4,
+ "STANDARD_E2AS_V4": 4,
+ "STANDARD_E2AS_V5": 4,
+ "STANDARD_E2A_V4": 4,
+ "STANDARD_E2DS_V4": 4,
+ "STANDARD_E2DS_V5": 4,
+ "STANDARD_E2D_V4": 4,
+ "STANDARD_E2D_V5": 4,
+ "STANDARD_E2S_V3": 4,
+ "STANDARD_E2S_V4": 4,
+ "STANDARD_E2S_V5": 4,
+ "STANDARD_E2_V3": 4,
+ "STANDARD_E2_V4": 4,
+ "STANDARD_E2_V5": 4,
+ "STANDARD_E32-16ADS_V5": 32,
+ "STANDARD_E32-16AS_V4": 32,
+ "STANDARD_E32-16AS_V5": 32,
+ "STANDARD_E32-16DS_V4": 32,
+ "STANDARD_E32-16DS_V5": 32,
+ "STANDARD_E32-16S_V3": 32,
+ "STANDARD_E32-16S_V4": 32,
+ "STANDARD_E32-16S_V5": 32,
+ "STANDARD_E32-8ADS_V5": 32,
+ "STANDARD_E32-8AS_V4": 32,
+ "STANDARD_E32-8AS_V5": 32,
+ "STANDARD_E32-8DS_V4": 32,
+ "STANDARD_E32-8DS_V5": 32,
+ "STANDARD_E32-8S_V3": 32,
+ "STANDARD_E32-8S_V4": 32,
+ "STANDARD_E32-8S_V5": 32,
+ "STANDARD_E32ADS_V5": 32,
+ "STANDARD_E32AS_V4": 32,
+ "STANDARD_E32AS_V5": 32,
+ "STANDARD_E32A_V4": 32,
+ "STANDARD_E32DS_V4": 32,
+ "STANDARD_E32DS_V5": 32,
+ "STANDARD_E32D_V4": 32,
+ "STANDARD_E32D_V5": 32,
+ "STANDARD_E32S_V3": 32,
+ "STANDARD_E32S_V4": 32,
+ "STANDARD_E32S_V5": 32,
+ "STANDARD_E32_V3": 32,
+ "STANDARD_E32_V4": 32,
+ "STANDARD_E32_V5": 32,
+ "STANDARD_E4-2ADS_V5": 8,
+ "STANDARD_E4-2AS_V4": 8,
+ "STANDARD_E4-2AS_V5": 8,
+ "STANDARD_E4-2DS_V4": 8,
+ "STANDARD_E4-2DS_V5": 8,
+ "STANDARD_E4-2S_V3": 8,
+ "STANDARD_E4-2S_V4": 8,
+ "STANDARD_E4-2S_V5": 8,
+ "STANDARD_E48ADS_V5": 32,
+ "STANDARD_E48AS_V4": 32,
+ "STANDARD_E48AS_V5": 32,
+ "STANDARD_E48A_V4": 32,
+ "STANDARD_E48DS_V4": 32,
+ "STANDARD_E48DS_V5": 32,
+ "STANDARD_E48D_V4": 32,
+ "STANDARD_E48D_V5": 32,
+ "STANDARD_E48S_V3": 32,
+ "STANDARD_E48S_V4": 32,
+ "STANDARD_E48S_V5": 32,
+ "STANDARD_E48_V3": 32,
+ "STANDARD_E48_V4": 32,
+ "STANDARD_E48_V5": 32,
+ "STANDARD_E4ADS_V5": 8,
+ "STANDARD_E4AS_V4": 8,
+ "STANDARD_E4AS_V5": 8,
+ "STANDARD_E4A_V4": 8,
+ "STANDARD_E4DS_V4": 8,
+ "STANDARD_E4DS_V5": 8,
+ "STANDARD_E4D_V4": 8,
+ "STANDARD_E4D_V5": 8,
+ "STANDARD_E4S_V3": 8,
+ "STANDARD_E4S_V4": 8,
+ "STANDARD_E4S_V5": 8,
+ "STANDARD_E4_V3": 8,
+ "STANDARD_E4_V4": 8,
+ "STANDARD_E4_V5": 8,
+ "STANDARD_E64-16ADS_V5": 32,
+ "STANDARD_E64-16AS_V4": 32,
+ "STANDARD_E64-16AS_V5": 32,
+ "STANDARD_E64-16DS_V4": 32,
+ "STANDARD_E64-16DS_V5": 32,
+ "STANDARD_E64-16S_V3": 32,
+ "STANDARD_E64-16S_V4": 32,
+ "STANDARD_E64-16S_V5": 32,
+ "STANDARD_E64-32ADS_V5": 32,
+ "STANDARD_E64-32AS_V4": 32,
+ "STANDARD_E64-32AS_V5": 32,
+ "STANDARD_E64-32DS_V4": 32,
+ "STANDARD_E64-32DS_V5": 32,
+ "STANDARD_E64-32S_V3": 32,
+ "STANDARD_E64-32S_V4": 32,
+ "STANDARD_E64-32S_V5": 32,
+ "STANDARD_E64ADS_V5": 32,
+ "STANDARD_E64AS_V4": 32,
+ "STANDARD_E64AS_V5": 32,
+ "STANDARD_E64A_V4": 32,
+ "STANDARD_E64DS_V4": 32,
+ "STANDARD_E64DS_V5": 32,
+ "STANDARD_E64D_V4": 32,
+ "STANDARD_E64D_V5": 32,
+ "STANDARD_E64IS_V3": 32,
+ "STANDARD_E64I_V3": 32,
+ "STANDARD_E64S_V3": 32,
+ "STANDARD_E64S_V4": 32,
+ "STANDARD_E64S_V5": 32,
+ "STANDARD_E64_V3": 32,
+ "STANDARD_E64_V4": 32,
+ "STANDARD_E64_V5": 32,
+ "STANDARD_E80IDS_V4": 64,
+ "STANDARD_E80IS_V4": 64,
+ "STANDARD_E8-2ADS_V5": 16,
+ "STANDARD_E8-2AS_V4": 16,
+ "STANDARD_E8-2AS_V5": 16,
+ "STANDARD_E8-2DS_V4": 16,
+ "STANDARD_E8-2DS_V5": 16,
+ "STANDARD_E8-2S_V3": 16,
+ "STANDARD_E8-2S_V4": 16,
+ "STANDARD_E8-2S_V5": 16,
+ "STANDARD_E8-4ADS_V5": 16,
+ "STANDARD_E8-4AS_V4": 16,
+ "STANDARD_E8-4AS_V5": 16,
+ "STANDARD_E8-4DS_V4": 16,
+ "STANDARD_E8-4DS_V5": 32,
+ "STANDARD_E8-4S_V3": 16,
+ "STANDARD_E8-4S_V4": 16,
+ "STANDARD_E8-4S_V5": 32,
+ "STANDARD_E8ADS_V5": 16,
+ "STANDARD_E8AS_V4": 16,
+ "STANDARD_E8AS_V5": 16,
+ "STANDARD_E8A_V4": 16,
+ "STANDARD_E8DS_V4": 16,
+ "STANDARD_E8DS_V5": 16,
+ "STANDARD_E8D_V4": 16,
+ "STANDARD_E8D_V5": 16,
+ "STANDARD_E8S_V3": 16,
+ "STANDARD_E8S_V4": 16,
+ "STANDARD_E8S_V5": 16,
+ "STANDARD_E8_V3": 16,
+ "STANDARD_E8_V4": 16,
+ "STANDARD_E8_V5": 16,
+ "STANDARD_E96-24ADS_V5": 32,
+ "STANDARD_E96-24AS_V4": 32,
+ "STANDARD_E96-24AS_V5": 32,
+ "STANDARD_E96-24DS_V5": 32,
+ "STANDARD_E96-24S_V5": 32,
+ "STANDARD_E96-48ADS_V5": 32,
+ "STANDARD_E96-48AS_V4": 32,
+ "STANDARD_E96-48AS_V5": 32,
+ "STANDARD_E96-48DS_V5": 32,
+ "STANDARD_E96-48S_V5": 32,
+ "STANDARD_E96ADS_V5": 32,
+ "STANDARD_E96AS_V4": 32,
+ "STANDARD_E96AS_V5": 32,
+ "STANDARD_E96A_V4": 32,
+ "STANDARD_E96DS_V5": 32,
+ "STANDARD_E96D_V5": 32,
+ "STANDARD_E96S_V5": 32,
+ "STANDARD_E96_V5": 32,
+ "STANDARD_EC16ADS_V5": 32,
+ "STANDARD_EC16AS_V5": 32,
+ "STANDARD_EC20ADS_V5": 32,
+ "STANDARD_EC20AS_V5": 32,
+ "STANDARD_EC2ADS_V5": 4,
+ "STANDARD_EC2AS_V5": 4,
+ "STANDARD_EC32ADS_V5": 32,
+ "STANDARD_EC32AS_V5": 32,
+ "STANDARD_EC48ADS_V5": 32,
+ "STANDARD_EC48AS_V5": 32,
+ "STANDARD_EC4ADS_V5": 8,
+ "STANDARD_EC4AS_V5": 8,
+ "STANDARD_EC64ADS_V5": 32,
+ "STANDARD_EC64AS_V5": 32,
+ "STANDARD_EC8ADS_V5": 16,
+ "STANDARD_EC8AS_V5": 16,
+ "STANDARD_EC96ADS_V5": 32,
+ "STANDARD_EC96AS_V5": 32,
+ "STANDARD_EC96IADS_V5": 32,
+ "STANDARD_EC96IAS_V5": 32,
+ "STANDARD_F1": 4,
+ "STANDARD_F16": 64,
+ "STANDARD_F16S": 64,
+ "STANDARD_F16S_V2": 32,
+ "STANDARD_F1S": 4,
+ "STANDARD_F2": 8,
+ "STANDARD_F2S": 8,
+ "STANDARD_F2S_V2": 4,
+ "STANDARD_F32S_V2": 32,
+ "STANDARD_F4": 16,
+ "STANDARD_F48S_V2": 32,
+ "STANDARD_F4S": 16,
+ "STANDARD_F4S_V2": 8,
+ "STANDARD_F64S_V2": 32,
+ "STANDARD_F72S_V2": 32,
+ "STANDARD_F8": 32,
+ "STANDARD_F8S": 32,
+ "STANDARD_F8S_V2": 16,
+ "STANDARD_FX12MDS": 24,
+ "STANDARD_FX24MDS": 32,
+ "STANDARD_FX36MDS": 32,
+ "STANDARD_FX48MDS": 32,
+ "STANDARD_FX4MDS": 8,
+ "STANDARD_G1": 8,
+ "STANDARD_G2": 16,
+ "STANDARD_G3": 32,
+ "STANDARD_G4": 64,
+ "STANDARD_G5": 64,
+ "STANDARD_GS1": 8,
+ "STANDARD_GS2": 16,
+ "STANDARD_GS3": 32,
+ "STANDARD_GS4-4": 64,
+ "STANDARD_GS4": 64,
+ "STANDARD_GS4-8": 64,
+ "STANDARD_GS5-16": 64,
+ "STANDARD_GS5": 64,
+ "STANDARD_GS5-8": 64,
+ "STANDARD_H16": 64,
+ "STANDARD_H16M": 64,
+ "STANDARD_H16M_PROMO": 64,
+ "STANDARD_H16MR": 64,
+ "STANDARD_H16MR_PROMO": 64,
+ "STANDARD_H16_PROMO": 64,
+ "STANDARD_H16R": 64,
+ "STANDARD_H16R_PROMO": 64,
+ "STANDARD_H8": 32,
+ "STANDARD_H8M": 32,
+ "STANDARD_H8M_PROMO": 32,
+ "STANDARD_H8_PROMO": 32,
+ "STANDARD_HB120-16RS_V3": 32,
+ "STANDARD_HB120-32RS_V3": 32,
+ "STANDARD_HB120-64RS_V3": 32,
+ "STANDARD_HB120-96RS_V3": 32,
+ "STANDARD_HB120RS_V2": 8,
+ "STANDARD_HB120RS_V3": 32,
+ "STANDARD_HB60-15RS": 4,
+ "STANDARD_HB60-30RS": 4,
+ "STANDARD_HB60-45RS": 4,
+ "STANDARD_HB60RS": 4,
+ "STANDARD_HC44-16RS": 4,
+ "STANDARD_HC44-32RS": 4,
+ "STANDARD_HC44RS": 4,
+ "STANDARD_L16S": 64,
+ "STANDARD_L16S_V2": 32,
+ "STANDARD_L32S": 64,
+ "STANDARD_L32S_V2": 32,
+ "STANDARD_L48S_V2": 32,
+ "STANDARD_L4S": 16,
+ "STANDARD_L64S_V2": 32,
+ "STANDARD_L80S_V2": 32,
+ "STANDARD_L8S": 32,
+ "STANDARD_L8S_V2": 16,
+ "STANDARD_M128-32MS": 64,
+ "STANDARD_M128": 64,
+ "STANDARD_M128-64MS": 64,
+ "STANDARD_M128DMS_V2": 64,
+ "STANDARD_M128DS_V2": 64,
+ "STANDARD_M128M": 64,
+ "STANDARD_M128MS": 64,
+ "STANDARD_M128MS_V2": 64,
+ "STANDARD_M128S": 64,
+ "STANDARD_M128S_V2": 64,
+ "STANDARD_M16-4MS": 16,
+ "STANDARD_M16-8MS": 16,
+ "STANDARD_M16MS": 16,
+ "STANDARD_M192IDMS_V2": 64,
+ "STANDARD_M192IDS_V2": 64,
+ "STANDARD_M192IMS_V2": 64,
+ "STANDARD_M192IS_V2": 64,
+ "STANDARD_M208MS_V2": 64,
+ "STANDARD_M208S_V2": 64,
+ "STANDARD_M32-16MS": 32,
+ "STANDARD_M32-8MS": 32,
+ "STANDARD_M32DMS_V2": 32,
+ "STANDARD_M32LS": 32,
+ "STANDARD_M32MS": 32,
+ "STANDARD_M32MS_V2": 32,
+ "STANDARD_M32TS": 32,
+ "STANDARD_M416-208MS_V2": 64,
+ "STANDARD_M416-208S_V2": 64,
+ "STANDARD_M416MS_V2": 64,
+ "STANDARD_M416S_V2": 64,
+ "STANDARD_M64-16MS": 64,
+ "STANDARD_M64-32MS": 64,
+ "STANDARD_M64": 64,
+ "STANDARD_M64DMS_V2": 64,
+ "STANDARD_M64DS_V2": 64,
+ "STANDARD_M64LS": 64,
+ "STANDARD_M64M": 64,
+ "STANDARD_M64MS": 64,
+ "STANDARD_M64MS_V2": 64,
+ "STANDARD_M64S": 64,
+ "STANDARD_M64S_V2": 64,
+ "STANDARD_M8-2MS": 8,
+ "STANDARD_M832IXS": 64,
+ "STANDARD_M8-4MS": 8,
+ "STANDARD_M864IXS": 64,
+ "STANDARD_M8MS": 8,
+ "STANDARD_NC12": 48,
+ "STANDARD_NC12_PROMO": 48,
+ "STANDARD_NC12S_V2": 24,
+ "STANDARD_NC12S_V3": 24,
+ "STANDARD_NC16AS_T4_V3": 32,
+ "STANDARD_NC24": 64,
+ "STANDARD_NC24_PROMO": 64,
+ "STANDARD_NC24R": 64,
+ "STANDARD_NC24R_PROMO": 64,
+ "STANDARD_NC24RS_V2": 32,
+ "STANDARD_NC24RS_V3": 32,
+ "STANDARD_NC24S_V2": 32,
+ "STANDARD_NC24S_V3": 32,
+ "STANDARD_NC4AS_T4_V3": 8,
+ "STANDARD_NC6": 24,
+ "STANDARD_NC64AS_T4_V3": 32,
+ "STANDARD_NC6_PROMO": 24,
+ "STANDARD_NC6S_V2": 12,
+ "STANDARD_NC6S_V3": 12,
+ "STANDARD_NC8AS_T4_V3": 16,
+ "STANDARD_ND12S": 24,
+ "STANDARD_ND24RS": 32,
+ "STANDARD_ND24S": 32,
+ "STANDARD_ND40RS_V2": 8,
+ "STANDARD_ND40S_V3": 32,
+ "STANDARD_ND6S": 12,
+ "STANDARD_ND96AMSR_A100_V4": 16,
+ "STANDARD_ND96ASR_V4": 16,
+ "STANDARD_NP10S": 8,
+ "STANDARD_NP20S": 16,
+ "STANDARD_NP40S": 32,
+ "STANDARD_NV12": 48,
+ "STANDARD_NV12_PROMO": 48,
+ "STANDARD_NV12S_V2": 24,
+ "STANDARD_NV12S_V3": 12,
+ "STANDARD_NV16AS_V4": 32,
+ "STANDARD_NV24": 64,
+ "STANDARD_NV24_PROMO": 64,
+ "STANDARD_NV24S_V2": 32,
+ "STANDARD_NV24S_V3": 24,
+ "STANDARD_NV32AS_V4": 32,
+ "STANDARD_NV48S_V3": 32,
+ "STANDARD_NV4AS_V4": 8,
+ "STANDARD_NV6": 24,
+ "STANDARD_NV6_PROMO": 24,
+ "STANDARD_NV6S_V2": 12,
+ "STANDARD_NV8AS_V4": 16,
+ "STANDARD_PB6S": 12,
}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md b/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md
deleted file mode 100644
index 9f871638b0..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# Azure Storage SDK for Go (Preview)
-
-:exclamation: IMPORTANT: This package is in maintenance only and will be deprecated in the
-future. Please use one of the following packages instead.
-
-| Service | Import Path/Repo |
-|---------|------------------|
-| Storage - Blobs | [github.com/Azure/azure-storage-blob-go](https://github.com/Azure/azure-storage-blob-go) |
-| Storage - Files | [github.com/Azure/azure-storage-file-go](https://github.com/Azure/azure-storage-file-go) |
-| Storage - Queues | [github.com/Azure/azure-storage-queue-go](https://github.com/Azure/azure-storage-queue-go) |
-
-The `github.com/Azure/azure-sdk-for-go/storage` package is used to manage
-[Azure Storage](https://docs.microsoft.com/azure/storage/) data plane
-resources: containers, blobs, tables, and queues.
-
-To manage storage *accounts* use Azure Resource Manager (ARM) via the packages
-at [github.com/Azure/azure-sdk-for-go/services/storage](https://github.com/Azure/azure-sdk-for-go/tree/main/services/storage).
-
-This package also supports the [Azure Storage
-Emulator](https://azure.microsoft.com/documentation/articles/storage-use-emulator/)
-(Windows only).
-
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go
deleted file mode 100644
index 306dd1b711..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/appendblob.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/base64"
- "fmt"
- "net/http"
- "net/url"
- "time"
-)
-
-// PutAppendBlob initializes an empty append blob with specified name. An
-// append blob must be created using this method before appending blocks.
-//
-// See CreateBlockBlobFromReader for more info on creating blobs.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob
-func (b *Blob) PutAppendBlob(options *PutBlobOptions) error {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-blob-type"] = string(BlobTypeAppend)
- headers = mergeHeaders(headers, headersFromStruct(b.Properties))
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypeAppend)
-}
-
-// AppendBlockOptions includes the options for an append block operation
-type AppendBlockOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- MaxSize *uint `header:"x-ms-blob-condition-maxsize"`
- AppendPosition *uint `header:"x-ms-blob-condition-appendpos"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
- ContentMD5 bool
-}
-
-// AppendBlock appends a block to an append blob.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Append-Block
-func (b *Blob) AppendBlock(chunk []byte, options *AppendBlockOptions) error {
- params := url.Values{"comp": {"appendblock"}}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["Content-Length"] = fmt.Sprintf("%v", len(chunk))
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- if options.ContentMD5 {
- md5sum := md5.Sum(chunk)
- headers[headerContentMD5] = base64.StdEncoding.EncodeToString(md5sum[:])
- }
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes.NewReader(chunk), b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypeAppend)
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go
deleted file mode 100644
index 01741524af..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/authorization.go
+++ /dev/null
@@ -1,235 +0,0 @@
-// Package storage provides clients for Microsoft Azure Storage Services.
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "fmt"
- "net/url"
- "sort"
- "strings"
-)
-
-// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/authentication-for-the-azure-storage-services
-
-type authentication string
-
-const (
- sharedKey authentication = "sharedKey"
- sharedKeyForTable authentication = "sharedKeyTable"
- sharedKeyLite authentication = "sharedKeyLite"
- sharedKeyLiteForTable authentication = "sharedKeyLiteTable"
-
- // headers
- headerAcceptCharset = "Accept-Charset"
- headerAuthorization = "Authorization"
- headerContentLength = "Content-Length"
- headerDate = "Date"
- headerXmsDate = "x-ms-date"
- headerXmsVersion = "x-ms-version"
- headerContentEncoding = "Content-Encoding"
- headerContentLanguage = "Content-Language"
- headerContentType = "Content-Type"
- headerContentMD5 = "Content-MD5"
- headerIfModifiedSince = "If-Modified-Since"
- headerIfMatch = "If-Match"
- headerIfNoneMatch = "If-None-Match"
- headerIfUnmodifiedSince = "If-Unmodified-Since"
- headerRange = "Range"
- headerDataServiceVersion = "DataServiceVersion"
- headerMaxDataServiceVersion = "MaxDataServiceVersion"
- headerContentTransferEncoding = "Content-Transfer-Encoding"
-)
-
-func (c *Client) addAuthorizationHeader(verb, url string, headers map[string]string, auth authentication) (map[string]string, error) {
- if !c.sasClient {
- authHeader, err := c.getSharedKey(verb, url, headers, auth)
- if err != nil {
- return nil, err
- }
- headers[headerAuthorization] = authHeader
- }
- return headers, nil
-}
-
-func (c *Client) getSharedKey(verb, url string, headers map[string]string, auth authentication) (string, error) {
- canRes, err := c.buildCanonicalizedResource(url, auth, false)
- if err != nil {
- return "", err
- }
-
- canString, err := buildCanonicalizedString(verb, headers, canRes, auth)
- if err != nil {
- return "", err
- }
- return c.createAuthorizationHeader(canString, auth), nil
-}
-
-func (c *Client) buildCanonicalizedResource(uri string, auth authentication, sas bool) (string, error) {
- errMsg := "buildCanonicalizedResource error: %s"
- u, err := url.Parse(uri)
- if err != nil {
- return "", fmt.Errorf(errMsg, err.Error())
- }
-
- cr := bytes.NewBufferString("")
- if c.accountName != StorageEmulatorAccountName || !sas {
- cr.WriteString("/")
- cr.WriteString(c.getCanonicalizedAccountName())
- }
-
- if len(u.Path) > 0 {
- // Any portion of the CanonicalizedResource string that is derived from
- // 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())
- }
-
- params, err := url.ParseQuery(u.RawQuery)
- if err != nil {
- return "", fmt.Errorf(errMsg, err.Error())
- }
-
- // See https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Core/Util/AuthenticationUtility.cs#L277
- if auth == sharedKey {
- if len(params) > 0 {
- cr.WriteString("\n")
-
- keys := []string{}
- for key := range params {
- keys = append(keys, key)
- }
- sort.Strings(keys)
-
- completeParams := []string{}
- for _, key := range keys {
- if len(params[key]) > 1 {
- sort.Strings(params[key])
- }
-
- completeParams = append(completeParams, fmt.Sprintf("%s:%s", key, strings.Join(params[key], ",")))
- }
- cr.WriteString(strings.Join(completeParams, "\n"))
- }
- } else {
- // search for "comp" parameter, if exists then add it to canonicalizedresource
- if v, ok := params["comp"]; ok {
- cr.WriteString("?comp=" + v[0])
- }
- }
-
- return string(cr.Bytes()), nil
-}
-
-func (c *Client) getCanonicalizedAccountName() string {
- // since we may be trying to access a secondary storage account, we need to
- // remove the -secondary part of the storage name
- return strings.TrimSuffix(c.accountName, "-secondary")
-}
-
-func buildCanonicalizedString(verb string, headers map[string]string, canonicalizedResource string, auth authentication) (string, error) {
- contentLength := headers[headerContentLength]
- if contentLength == "0" {
- contentLength = ""
- }
- date := headers[headerDate]
- if v, ok := headers[headerXmsDate]; ok {
- if auth == sharedKey || auth == sharedKeyLite {
- date = ""
- } else {
- date = v
- }
- }
- var canString string
- switch auth {
- case sharedKey:
- canString = strings.Join([]string{
- verb,
- headers[headerContentEncoding],
- headers[headerContentLanguage],
- contentLength,
- headers[headerContentMD5],
- headers[headerContentType],
- date,
- headers[headerIfModifiedSince],
- headers[headerIfMatch],
- headers[headerIfNoneMatch],
- headers[headerIfUnmodifiedSince],
- headers[headerRange],
- buildCanonicalizedHeader(headers),
- canonicalizedResource,
- }, "\n")
- case sharedKeyForTable:
- canString = strings.Join([]string{
- verb,
- headers[headerContentMD5],
- headers[headerContentType],
- date,
- canonicalizedResource,
- }, "\n")
- case sharedKeyLite:
- canString = strings.Join([]string{
- verb,
- headers[headerContentMD5],
- headers[headerContentType],
- date,
- buildCanonicalizedHeader(headers),
- canonicalizedResource,
- }, "\n")
- case sharedKeyLiteForTable:
- canString = strings.Join([]string{
- date,
- canonicalizedResource,
- }, "\n")
- default:
- return "", fmt.Errorf("%s authentication is not supported yet", auth)
- }
- return canString, nil
-}
-
-func buildCanonicalizedHeader(headers map[string]string) string {
- cm := make(map[string]string)
-
- for k, v := range headers {
- headerName := strings.TrimSpace(strings.ToLower(k))
- if strings.HasPrefix(headerName, "x-ms-") {
- cm[headerName] = v
- }
- }
-
- if len(cm) == 0 {
- return ""
- }
-
- keys := []string{}
- for key := range cm {
- keys = append(keys, key)
- }
-
- sort.Strings(keys)
-
- ch := bytes.NewBufferString("")
-
- for _, key := range keys {
- ch.WriteString(key)
- ch.WriteRune(':')
- ch.WriteString(cm[key])
- ch.WriteRune('\n')
- }
-
- return strings.TrimSuffix(string(ch.Bytes()), "\n")
-}
-
-func (c *Client) createAuthorizationHeader(canonicalizedString string, auth authentication) string {
- signature := c.computeHmac256(canonicalizedString)
- var key string
- switch auth {
- case sharedKey, sharedKeyForTable:
- key = "SharedKey"
- case sharedKeyLite, sharedKeyLiteForTable:
- key = "SharedKeyLite"
- }
- return fmt.Sprintf("%s %s:%s", key, c.getCanonicalizedAccountName(), signature)
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go
deleted file mode 100644
index 462e3dcf2f..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blob.go
+++ /dev/null
@@ -1,621 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-// A Blob is an entry in BlobListResponse.
-type Blob struct {
- Container *Container
- Name string `xml:"Name"`
- Snapshot time.Time `xml:"Snapshot"`
- Properties BlobProperties `xml:"Properties"`
- Metadata BlobMetadata `xml:"Metadata"`
-}
-
-// PutBlobOptions includes the options any put blob operation
-// (page, block, append)
-type PutBlobOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- Origin string `header:"Origin"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// BlobMetadata is a set of custom name/value pairs.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179404.aspx
-type BlobMetadata map[string]string
-
-type blobMetadataEntries struct {
- Entries []blobMetadataEntry `xml:",any"`
-}
-type blobMetadataEntry struct {
- XMLName xml.Name
- Value string `xml:",chardata"`
-}
-
-// UnmarshalXML converts the xml:Metadata into Metadata map
-func (bm *BlobMetadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
- var entries blobMetadataEntries
- if err := d.DecodeElement(&entries, &start); err != nil {
- return err
- }
- for _, entry := range entries.Entries {
- if *bm == nil {
- *bm = make(BlobMetadata)
- }
- (*bm)[strings.ToLower(entry.XMLName.Local)] = entry.Value
- }
- return nil
-}
-
-// MarshalXML implements the xml.Marshaler interface. It encodes
-// metadata name/value pairs as they would appear in an Azure
-// ListBlobs response.
-func (bm BlobMetadata) MarshalXML(enc *xml.Encoder, start xml.StartElement) error {
- entries := make([]blobMetadataEntry, 0, len(bm))
- for k, v := range bm {
- entries = append(entries, blobMetadataEntry{
- XMLName: xml.Name{Local: http.CanonicalHeaderKey(k)},
- Value: v,
- })
- }
- return enc.EncodeElement(blobMetadataEntries{
- Entries: entries,
- }, start)
-}
-
-// BlobProperties contains various properties of a blob
-// returned in various endpoints like ListBlobs or GetBlobProperties.
-type BlobProperties struct {
- LastModified TimeRFC1123 `xml:"Last-Modified"`
- Etag string `xml:"Etag"`
- ContentMD5 string `xml:"Content-MD5" header:"x-ms-blob-content-md5"`
- ContentLength int64 `xml:"Content-Length"`
- ContentType string `xml:"Content-Type" header:"x-ms-blob-content-type"`
- ContentEncoding string `xml:"Content-Encoding" header:"x-ms-blob-content-encoding"`
- CacheControl string `xml:"Cache-Control" header:"x-ms-blob-cache-control"`
- ContentLanguage string `xml:"Cache-Language" header:"x-ms-blob-content-language"`
- ContentDisposition string `xml:"Content-Disposition" header:"x-ms-blob-content-disposition"`
- BlobType BlobType `xml:"BlobType"`
- SequenceNumber int64 `xml:"x-ms-blob-sequence-number"`
- CopyID string `xml:"CopyId"`
- CopyStatus string `xml:"CopyStatus"`
- CopySource string `xml:"CopySource"`
- CopyProgress string `xml:"CopyProgress"`
- CopyCompletionTime TimeRFC1123 `xml:"CopyCompletionTime"`
- CopyStatusDescription string `xml:"CopyStatusDescription"`
- LeaseStatus string `xml:"LeaseStatus"`
- LeaseState string `xml:"LeaseState"`
- LeaseDuration string `xml:"LeaseDuration"`
- ServerEncrypted bool `xml:"ServerEncrypted"`
- IncrementalCopy bool `xml:"IncrementalCopy"`
-}
-
-// BlobType defines the type of the Azure Blob.
-type BlobType string
-
-// Types of page blobs
-const (
- BlobTypeBlock BlobType = "BlockBlob"
- BlobTypePage BlobType = "PageBlob"
- BlobTypeAppend BlobType = "AppendBlob"
-)
-
-func (b *Blob) buildPath() string {
- return b.Container.buildPath() + "/" + b.Name
-}
-
-// Exists returns true if a blob with given name exists on the specified
-// container of the storage account.
-func (b *Blob) Exists() (bool, error) {
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), nil)
- headers := b.Container.bsc.client.getStandardHeaders()
- resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusOK, nil
- }
- }
- return false, err
-}
-
-// GetURL gets the canonical URL to the blob with the specified name in the
-// specified container.
-// This method does not create a publicly accessible URL if the blob or container
-// is private and this method does not check if the blob exists.
-func (b *Blob) GetURL() string {
- container := b.Container.Name
- if container == "" {
- container = "$root"
- }
- return b.Container.bsc.client.getEndpoint(blobServiceName, pathForResource(container, b.Name), nil)
-}
-
-// GetBlobRangeOptions includes the options for a get blob range operation
-type GetBlobRangeOptions struct {
- Range *BlobRange
- GetRangeContentMD5 bool
- *GetBlobOptions
-}
-
-// GetBlobOptions includes the options for a get blob operation
-type GetBlobOptions struct {
- Timeout uint
- Snapshot *time.Time
- LeaseID string `header:"x-ms-lease-id"`
- Origin string `header:"Origin"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// BlobRange represents the bytes range to be get
-type BlobRange struct {
- Start uint64
- End uint64
-}
-
-func (br BlobRange) String() string {
- if br.End == 0 {
- return fmt.Sprintf("bytes=%d-", br.Start)
- }
- return fmt.Sprintf("bytes=%d-%d", br.Start, br.End)
-}
-
-// Get returns a stream to read the blob. Caller must call both Read and Close()
-// to correctly close the underlying connection.
-//
-// See the GetRange method for use with a Range header.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob
-func (b *Blob) Get(options *GetBlobOptions) (io.ReadCloser, error) {
- rangeOptions := GetBlobRangeOptions{
- GetBlobOptions: options,
- }
- resp, err := b.getRange(&rangeOptions)
- if err != nil {
- return nil, err
- }
-
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
- if err := b.writeProperties(resp.Header, true); err != nil {
- return resp.Body, err
- }
- return resp.Body, nil
-}
-
-// GetRange reads the specified range of a blob to a stream. The bytesRange
-// string must be in a format like "0-", "10-100" as defined in HTTP 1.1 spec.
-// Caller must call both Read and Close()// to correctly close the underlying
-// connection.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Blob
-func (b *Blob) GetRange(options *GetBlobRangeOptions) (io.ReadCloser, error) {
- resp, err := b.getRange(options)
- if err != nil {
- return nil, err
- }
-
- if err := checkRespCode(resp, []int{http.StatusPartialContent}); err != nil {
- return nil, err
- }
- // Content-Length header should not be updated, as the service returns the range length
- // (which is not alwys the full blob length)
- if err := b.writeProperties(resp.Header, false); err != nil {
- return resp.Body, err
- }
- return resp.Body, nil
-}
-
-func (b *Blob) getRange(options *GetBlobRangeOptions) (*http.Response, error) {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- if options.Range != nil {
- headers["Range"] = options.Range.String()
- if options.GetRangeContentMD5 {
- headers["x-ms-range-get-content-md5"] = "true"
- }
- }
- if options.GetBlobOptions != nil {
- headers = mergeHeaders(headers, headersFromStruct(*options.GetBlobOptions))
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- }
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return nil, err
- }
- return resp, err
-}
-
-// SnapshotOptions includes the options for a snapshot blob operation
-type SnapshotOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// CreateSnapshot creates a snapshot for a blob
-// See https://msdn.microsoft.com/en-us/library/azure/ee691971.aspx
-func (b *Blob) CreateSnapshot(options *SnapshotOptions) (snapshotTimestamp *time.Time, err error) {
- params := url.Values{"comp": {"snapshot"}}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil || resp == nil {
- return nil, err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{http.StatusCreated}); err != nil {
- return nil, err
- }
-
- snapshotResponse := resp.Header.Get(http.CanonicalHeaderKey("x-ms-snapshot"))
- if snapshotResponse != "" {
- snapshotTimestamp, err := time.Parse(time.RFC3339, snapshotResponse)
- if err != nil {
- return nil, err
- }
- return &snapshotTimestamp, nil
- }
-
- return nil, errors.New("Snapshot not created")
-}
-
-// GetBlobPropertiesOptions includes the options for a get blob properties operation
-type GetBlobPropertiesOptions struct {
- Timeout uint
- Snapshot *time.Time
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetProperties provides various information about the specified blob.
-// See https://msdn.microsoft.com/en-us/library/azure/dd179394.aspx
-func (b *Blob) GetProperties(options *GetBlobPropertiesOptions) error {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodHead, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
- return b.writeProperties(resp.Header, true)
-}
-
-func (b *Blob) writeProperties(h http.Header, includeContentLen bool) error {
- var err error
-
- contentLength := b.Properties.ContentLength
- if includeContentLen {
- contentLengthStr := h.Get("Content-Length")
- if contentLengthStr != "" {
- contentLength, err = strconv.ParseInt(contentLengthStr, 0, 64)
- if err != nil {
- return err
- }
- }
- }
-
- var sequenceNum int64
- sequenceNumStr := h.Get("x-ms-blob-sequence-number")
- if sequenceNumStr != "" {
- sequenceNum, err = strconv.ParseInt(sequenceNumStr, 0, 64)
- if err != nil {
- return err
- }
- }
-
- lastModified, err := getTimeFromHeaders(h, "Last-Modified")
- if err != nil {
- return err
- }
-
- copyCompletionTime, err := getTimeFromHeaders(h, "x-ms-copy-completion-time")
- if err != nil {
- return err
- }
-
- b.Properties = BlobProperties{
- LastModified: TimeRFC1123(*lastModified),
- Etag: h.Get("Etag"),
- ContentMD5: h.Get("Content-MD5"),
- ContentLength: contentLength,
- ContentEncoding: h.Get("Content-Encoding"),
- ContentType: h.Get("Content-Type"),
- ContentDisposition: h.Get("Content-Disposition"),
- CacheControl: h.Get("Cache-Control"),
- ContentLanguage: h.Get("Content-Language"),
- SequenceNumber: sequenceNum,
- CopyCompletionTime: TimeRFC1123(*copyCompletionTime),
- CopyStatusDescription: h.Get("x-ms-copy-status-description"),
- CopyID: h.Get("x-ms-copy-id"),
- CopyProgress: h.Get("x-ms-copy-progress"),
- CopySource: h.Get("x-ms-copy-source"),
- CopyStatus: h.Get("x-ms-copy-status"),
- BlobType: BlobType(h.Get("x-ms-blob-type")),
- LeaseStatus: h.Get("x-ms-lease-status"),
- LeaseState: h.Get("x-ms-lease-state"),
- }
- b.writeMetadata(h)
- return nil
-}
-
-// SetBlobPropertiesOptions contains various properties of a blob and is an entry
-// in SetProperties
-type SetBlobPropertiesOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- Origin string `header:"Origin"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- SequenceNumberAction *SequenceNumberAction
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// SequenceNumberAction defines how the blob's sequence number should be modified
-type SequenceNumberAction string
-
-// Options for sequence number action
-const (
- SequenceNumberActionMax SequenceNumberAction = "max"
- SequenceNumberActionUpdate SequenceNumberAction = "update"
- SequenceNumberActionIncrement SequenceNumberAction = "increment"
-)
-
-// SetProperties replaces the BlobHeaders for the specified blob.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetBlobProperties. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Blob-Properties
-func (b *Blob) SetProperties(options *SetBlobPropertiesOptions) error {
- params := url.Values{"comp": {"properties"}}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers = mergeHeaders(headers, headersFromStruct(b.Properties))
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- if b.Properties.BlobType == BlobTypePage {
- headers = addToHeaders(headers, "x-ms-blob-content-length", fmt.Sprintf("%v", b.Properties.ContentLength))
- if options != nil && options.SequenceNumberAction != nil {
- headers = addToHeaders(headers, "x-ms-sequence-number-action", string(*options.SequenceNumberAction))
- if *options.SequenceNumberAction != SequenceNumberActionIncrement {
- headers = addToHeaders(headers, "x-ms-blob-sequence-number", fmt.Sprintf("%v", b.Properties.SequenceNumber))
- }
- }
- }
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusOK})
-}
-
-// SetBlobMetadataOptions includes the options for a set blob metadata operation
-type SetBlobMetadataOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// SetMetadata replaces the metadata for the specified blob.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetBlobMetadata. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
-func (b *Blob) SetMetadata(options *SetBlobMetadataOptions) error {
- params := url.Values{"comp": {"metadata"}}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusOK})
-}
-
-// GetBlobMetadataOptions includes the options for a get blob metadata operation
-type GetBlobMetadataOptions struct {
- Timeout uint
- Snapshot *time.Time
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetMetadata returns all user-defined metadata for the specified blob.
-//
-// All metadata keys will be returned in lower case. (HTTP header
-// names are case-insensitive.)
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
-func (b *Blob) GetMetadata(options *GetBlobMetadataOptions) error {
- params := url.Values{"comp": {"metadata"}}
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- b.writeMetadata(resp.Header)
- return nil
-}
-
-func (b *Blob) writeMetadata(h http.Header) {
- b.Metadata = BlobMetadata(writeMetadata(h))
-}
-
-// DeleteBlobOptions includes the options for a delete blob operation
-type DeleteBlobOptions struct {
- Timeout uint
- Snapshot *time.Time
- LeaseID string `header:"x-ms-lease-id"`
- DeleteSnapshots *bool
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Delete deletes the given blob from the specified container.
-// If the blob does not exist at the time of the Delete Blob operation, it
-// returns error.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob
-func (b *Blob) Delete(options *DeleteBlobOptions) error {
- resp, err := b.delete(options)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusAccepted})
-}
-
-// DeleteIfExists deletes the given blob from the specified container If the
-// blob is deleted with this call, returns true. Otherwise returns false.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Blob
-func (b *Blob) DeleteIfExists(options *DeleteBlobOptions) (bool, error) {
- resp, err := b.delete(options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusAccepted, nil
- }
- }
- return false, err
-}
-
-func (b *Blob) delete(options *DeleteBlobOptions) (*http.Response, error) {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- if options.DeleteSnapshots != nil {
- if *options.DeleteSnapshots {
- headers["x-ms-delete-snapshots"] = "include"
- } else {
- headers["x-ms-delete-snapshots"] = "only"
- }
- }
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
- return b.Container.bsc.client.exec(http.MethodDelete, uri, headers, nil, b.Container.bsc.auth)
-}
-
-// helper method to construct the path to either a blob or container
-func pathForResource(container, name string) string {
- if name != "" {
- return fmt.Sprintf("/%s/%s", container, name)
- }
- return fmt.Sprintf("/%s", container)
-}
-
-func (b *Blob) respondCreation(resp *http.Response, bt BlobType) error {
- defer drainRespBody(resp)
- err := checkRespCode(resp, []int{http.StatusCreated})
- if err != nil {
- return err
- }
- b.Properties.BlobType = bt
- return nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go
deleted file mode 100644
index 89ab054ec2..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobsasuri.go
+++ /dev/null
@@ -1,168 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "errors"
- "fmt"
- "net/url"
- "strings"
- "time"
-)
-
-// OverrideHeaders defines overridable response heaedrs in
-// a request using a SAS URI.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-type OverrideHeaders struct {
- CacheControl string
- ContentDisposition string
- ContentEncoding string
- ContentLanguage string
- ContentType string
-}
-
-// BlobSASOptions are options to construct a blob SAS
-// URI.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-type BlobSASOptions struct {
- BlobServiceSASPermissions
- OverrideHeaders
- SASOptions
-}
-
-// BlobServiceSASPermissions includes the available permissions for
-// blob service SAS URI.
-type BlobServiceSASPermissions struct {
- Read bool
- Add bool
- Create bool
- Write bool
- Delete bool
-}
-
-func (p BlobServiceSASPermissions) buildString() string {
- permissions := ""
- if p.Read {
- permissions += "r"
- }
- if p.Add {
- permissions += "a"
- }
- if p.Create {
- permissions += "c"
- }
- if p.Write {
- permissions += "w"
- }
- if p.Delete {
- permissions += "d"
- }
- return permissions
-}
-
-// GetSASURI creates an URL to the blob which contains the Shared
-// Access Signature with the specified options.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-func (b *Blob) GetSASURI(options BlobSASOptions) (string, error) {
- uri := b.GetURL()
- signedResource := "b"
- canonicalizedResource, err := b.Container.bsc.client.buildCanonicalizedResource(uri, b.Container.bsc.auth, true)
- if err != nil {
- return "", err
- }
-
- permissions := options.BlobServiceSASPermissions.buildString()
- return b.Container.bsc.client.blobAndFileSASURI(options.SASOptions, uri, permissions, canonicalizedResource, signedResource, options.OverrideHeaders)
-}
-
-func (c *Client) blobAndFileSASURI(options SASOptions, uri, permissions, canonicalizedResource, signedResource string, headers OverrideHeaders) (string, error) {
- start := ""
- if options.Start != (time.Time{}) {
- start = options.Start.UTC().Format(time.RFC3339)
- }
-
- expiry := options.Expiry.UTC().Format(time.RFC3339)
-
- // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component).
- canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1)
- canonicalizedResource, err := url.QueryUnescape(canonicalizedResource)
- if err != nil {
- return "", err
- }
-
- protocols := ""
- if options.UseHTTPS {
- protocols = "https"
- }
- stringToSign, err := blobSASStringToSign(permissions, start, expiry, canonicalizedResource, options.Identifier, options.IP, protocols, c.apiVersion, signedResource, "", headers)
- if err != nil {
- return "", err
- }
-
- sig := c.computeHmac256(stringToSign)
- sasParams := url.Values{
- "sv": {c.apiVersion},
- "se": {expiry},
- "sr": {signedResource},
- "sp": {permissions},
- "sig": {sig},
- }
-
- if start != "" {
- sasParams.Add("st", start)
- }
-
- if c.apiVersion >= "2015-04-05" {
- if protocols != "" {
- sasParams.Add("spr", protocols)
- }
- if options.IP != "" {
- sasParams.Add("sip", options.IP)
- }
- }
-
- // Add override response hedaers
- addQueryParameter(sasParams, "rscc", headers.CacheControl)
- addQueryParameter(sasParams, "rscd", headers.ContentDisposition)
- addQueryParameter(sasParams, "rsce", headers.ContentEncoding)
- addQueryParameter(sasParams, "rscl", headers.ContentLanguage)
- addQueryParameter(sasParams, "rsct", headers.ContentType)
-
- sasURL, err := url.Parse(uri)
- if err != nil {
- return "", err
- }
- sasURL.RawQuery = sasParams.Encode()
- return sasURL.String(), nil
-}
-
-func blobSASStringToSign(signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, signedResource, signedSnapshotTime string, headers OverrideHeaders) (string, error) {
- rscc := headers.CacheControl
- rscd := headers.ContentDisposition
- rsce := headers.ContentEncoding
- rscl := headers.ContentLanguage
- rsct := headers.ContentType
-
- if signedVersion >= "2015-02-21" {
- canonicalizedResource = "/blob" + canonicalizedResource
- }
-
- // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
- if signedVersion >= "2018-11-09" {
- return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, signedResource, signedSnapshotTime, rscc, rscd, rsce, rscl, rsct), nil
- }
-
- // https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12
- if signedVersion >= "2015-04-05" {
- return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedIP, protocols, signedVersion, rscc, rscd, rsce, rscl, rsct), nil
- }
-
- // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx
- if signedVersion >= "2013-08-15" {
- return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion, rscc, rscd, rsce, rscl, rsct), nil
- }
-
- return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15")
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go
deleted file mode 100644
index 0a985b22b0..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blobserviceclient.go
+++ /dev/null
@@ -1,175 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "fmt"
- "net/http"
- "net/url"
- "strconv"
- "strings"
-)
-
-// BlobStorageClient contains operations for Microsoft Azure Blob Storage
-// Service.
-type BlobStorageClient struct {
- client Client
- auth authentication
-}
-
-// GetServiceProperties gets the properties of your storage account's blob service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-blob-service-properties
-func (b *BlobStorageClient) GetServiceProperties() (*ServiceProperties, error) {
- return b.client.getServiceProperties(blobServiceName, b.auth)
-}
-
-// SetServiceProperties sets the properties of your storage account's blob service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-blob-service-properties
-func (b *BlobStorageClient) SetServiceProperties(props ServiceProperties) error {
- return b.client.setServiceProperties(props, blobServiceName, b.auth)
-}
-
-// ListContainersParameters defines the set of customizable parameters to make a
-// List Containers call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
-type ListContainersParameters struct {
- Prefix string
- Marker string
- Include string
- MaxResults uint
- Timeout uint
-}
-
-// GetContainerReference returns a Container object for the specified container name.
-func (b *BlobStorageClient) GetContainerReference(name string) *Container {
- return &Container{
- bsc: b,
- Name: name,
- }
-}
-
-// GetContainerReferenceFromSASURI returns a Container object for the specified
-// container SASURI
-func GetContainerReferenceFromSASURI(sasuri url.URL) (*Container, error) {
- path := strings.Split(sasuri.Path, "/")
- if len(path) <= 1 {
- return nil, fmt.Errorf("could not find a container in URI: %s", sasuri.String())
- }
- c, err := newSASClientFromURL(&sasuri)
- if err != nil {
- return nil, err
- }
- cli := c.GetBlobService()
- return &Container{
- bsc: &cli,
- Name: path[1],
- sasuri: sasuri,
- }, nil
-}
-
-// ListContainers returns the list of containers in a storage account along with
-// pagination token and other response details.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
-func (b BlobStorageClient) ListContainers(params ListContainersParameters) (*ContainerListResponse, error) {
- q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}})
- uri := b.client.getEndpoint(blobServiceName, "", q)
- headers := b.client.getStandardHeaders()
-
- type ContainerAlias struct {
- bsc *BlobStorageClient
- Name string `xml:"Name"`
- Properties ContainerProperties `xml:"Properties"`
- Metadata BlobMetadata
- sasuri url.URL
- }
- type ContainerListResponseAlias struct {
- XMLName xml.Name `xml:"EnumerationResults"`
- Xmlns string `xml:"xmlns,attr"`
- Prefix string `xml:"Prefix"`
- Marker string `xml:"Marker"`
- NextMarker string `xml:"NextMarker"`
- MaxResults int64 `xml:"MaxResults"`
- Containers []ContainerAlias `xml:"Containers>Container"`
- }
-
- var outAlias ContainerListResponseAlias
- resp, err := b.client.exec(http.MethodGet, uri, headers, nil, b.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- err = xmlUnmarshal(resp.Body, &outAlias)
- if err != nil {
- return nil, err
- }
-
- out := ContainerListResponse{
- XMLName: outAlias.XMLName,
- Xmlns: outAlias.Xmlns,
- Prefix: outAlias.Prefix,
- Marker: outAlias.Marker,
- NextMarker: outAlias.NextMarker,
- MaxResults: outAlias.MaxResults,
- Containers: make([]Container, len(outAlias.Containers)),
- }
- for i, cnt := range outAlias.Containers {
- out.Containers[i] = Container{
- bsc: &b,
- Name: cnt.Name,
- Properties: cnt.Properties,
- Metadata: map[string]string(cnt.Metadata),
- sasuri: cnt.sasuri,
- }
- }
-
- return &out, err
-}
-
-func (p ListContainersParameters) getParameters() url.Values {
- out := url.Values{}
-
- if p.Prefix != "" {
- out.Set("prefix", p.Prefix)
- }
- if p.Marker != "" {
- out.Set("marker", p.Marker)
- }
- if p.Include != "" {
- out.Set("include", p.Include)
- }
- if p.MaxResults != 0 {
- out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10))
- }
- if p.Timeout != 0 {
- out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10))
- }
-
- return out
-}
-
-func writeMetadata(h http.Header) map[string]string {
- metadata := make(map[string]string)
- for k, v := range h {
- // Can't trust CanonicalHeaderKey() to munge case
- // reliably. "_" is allowed in identifiers:
- // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
- // https://msdn.microsoft.com/library/aa664670(VS.71).aspx
- // http://tools.ietf.org/html/rfc7230#section-3.2
- // ...but "_" is considered invalid by
- // CanonicalMIMEHeaderKey in
- // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542
- // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl".
- k = strings.ToLower(k)
- if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) {
- continue
- }
- // metadata["lol"] = content of the last X-Ms-Meta-Lol header
- k = k[len(userDefinedMetadataHeaderPrefix):]
- metadata[k] = v[len(v)-1]
- }
- return metadata
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go
deleted file mode 100644
index 9d445decfd..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/blockblob.go
+++ /dev/null
@@ -1,300 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-// BlockListType is used to filter out types of blocks in a Get Blocks List call
-// for a block blob.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx for all
-// block types.
-type BlockListType string
-
-// Filters for listing blocks in block blobs
-const (
- BlockListTypeAll BlockListType = "all"
- BlockListTypeCommitted BlockListType = "committed"
- BlockListTypeUncommitted BlockListType = "uncommitted"
-)
-
-// Maximum sizes (per REST API) for various concepts
-const (
- MaxBlobBlockSize = 100 * 1024 * 1024
- MaxBlobPageSize = 4 * 1024 * 1024
-)
-
-// BlockStatus defines states a block for a block blob can
-// be in.
-type BlockStatus string
-
-// List of statuses that can be used to refer to a block in a block list
-const (
- BlockStatusUncommitted BlockStatus = "Uncommitted"
- BlockStatusCommitted BlockStatus = "Committed"
- BlockStatusLatest BlockStatus = "Latest"
-)
-
-// Block is used to create Block entities for Put Block List
-// call.
-type Block struct {
- ID string
- Status BlockStatus
-}
-
-// BlockListResponse contains the response fields from Get Block List call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179400.aspx
-type BlockListResponse struct {
- XMLName xml.Name `xml:"BlockList"`
- CommittedBlocks []BlockResponse `xml:"CommittedBlocks>Block"`
- UncommittedBlocks []BlockResponse `xml:"UncommittedBlocks>Block"`
-}
-
-// BlockResponse contains the block information returned
-// in the GetBlockListCall.
-type BlockResponse struct {
- Name string `xml:"Name"`
- Size int64 `xml:"Size"`
-}
-
-// CreateBlockBlob initializes an empty block blob with no blocks.
-//
-// See CreateBlockBlobFromReader for more info on creating blobs.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob
-func (b *Blob) CreateBlockBlob(options *PutBlobOptions) error {
- return b.CreateBlockBlobFromReader(nil, options)
-}
-
-// CreateBlockBlobFromReader initializes a block blob using data from
-// reader. Size must be the number of bytes read from reader. To
-// create an empty blob, use size==0 and reader==nil.
-//
-// Any headers set in blob.Properties or metadata in blob.Metadata
-// will be set on the blob.
-//
-// The API rejects requests with size > 256 MiB (but this limit is not
-// checked by the SDK). To write a larger blob, use CreateBlockBlob,
-// PutBlock, and PutBlockList.
-//
-// To create a blob from scratch, call container.GetBlobReference() to
-// get an empty blob, fill in blob.Properties and blob.Metadata as
-// appropriate then call this method.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob
-func (b *Blob) CreateBlockBlobFromReader(blob io.Reader, options *PutBlobOptions) error {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-blob-type"] = string(BlobTypeBlock)
-
- headers["Content-Length"] = "0"
- var n int64
- var err error
- if blob != nil {
- type lener interface {
- Len() int
- }
- // TODO(rjeczalik): handle io.ReadSeeker, in case blob is *os.File etc.
- if l, ok := blob.(lener); ok {
- n = int64(l.Len())
- } else {
- var buf bytes.Buffer
- n, err = io.Copy(&buf, blob)
- if err != nil {
- return err
- }
- blob = &buf
- }
-
- headers["Content-Length"] = strconv.FormatInt(n, 10)
- }
- b.Properties.ContentLength = n
-
- headers = mergeHeaders(headers, headersFromStruct(b.Properties))
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypeBlock)
-}
-
-// PutBlockOptions includes the options for a put block operation
-type PutBlockOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- ContentMD5 string `header:"Content-MD5"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// PutBlock saves the given data chunk to the specified block blob with
-// given ID.
-//
-// The API rejects chunks larger than 100 MiB (but this limit is not
-// checked by the SDK).
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block
-func (b *Blob) PutBlock(blockID string, chunk []byte, options *PutBlockOptions) error {
- return b.PutBlockWithLength(blockID, uint64(len(chunk)), bytes.NewReader(chunk), options)
-}
-
-// PutBlockWithLength saves the given data stream of exactly specified size to
-// the block blob with given ID. It is an alternative to PutBlocks where data
-// comes as stream but the length is known in advance.
-//
-// The API rejects requests with size > 100 MiB (but this limit is not
-// checked by the SDK).
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block
-func (b *Blob) PutBlockWithLength(blockID string, size uint64, blob io.Reader, options *PutBlockOptions) error {
- query := url.Values{
- "comp": {"block"},
- "blockid": {blockID},
- }
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["Content-Length"] = fmt.Sprintf("%v", size)
-
- if options != nil {
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), query)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, blob, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypeBlock)
-}
-
-// PutBlockFromURLOptions includes the options for a put block from URL operation
-type PutBlockFromURLOptions struct {
- PutBlockOptions
-
- SourceContentMD5 string `header:"x-ms-source-content-md5"`
- SourceContentCRC64 string `header:"x-ms-source-content-crc64"`
-}
-
-// PutBlockFromURL copy data of exactly specified size from specified URL to
-// the block blob with given ID. It is an alternative to PutBlocks where data
-// comes from a remote URL and the offset and length is known in advance.
-//
-// The API rejects requests with size > 100 MiB (but this limit is not
-// checked by the SDK).
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/put-block-from-url
-func (b *Blob) PutBlockFromURL(blockID string, blobURL string, offset int64, size uint64, options *PutBlockFromURLOptions) error {
- query := url.Values{
- "comp": {"block"},
- "blockid": {blockID},
- }
- headers := b.Container.bsc.client.getStandardHeaders()
- // The value of this header must be set to zero.
- // When the length is not zero, the operation will fail with the status code 400 (Bad Request).
- headers["Content-Length"] = "0"
- headers["x-ms-copy-source"] = blobURL
- headers["x-ms-source-range"] = fmt.Sprintf("bytes=%d-%d", offset, uint64(offset)+size-1)
-
- if options != nil {
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), query)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypeBlock)
-}
-
-// PutBlockListOptions includes the options for a put block list operation
-type PutBlockListOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// PutBlockList saves list of blocks to the specified block blob.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Block-List
-func (b *Blob) PutBlockList(blocks []Block, options *PutBlockListOptions) error {
- params := url.Values{"comp": {"blocklist"}}
- blockListXML := prepareBlockListRequest(blocks)
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["Content-Length"] = fmt.Sprintf("%v", len(blockListXML))
- headers = mergeHeaders(headers, headersFromStruct(b.Properties))
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, strings.NewReader(blockListXML), b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusCreated})
-}
-
-// GetBlockListOptions includes the options for a get block list operation
-type GetBlockListOptions struct {
- Timeout uint
- Snapshot *time.Time
- LeaseID string `header:"x-ms-lease-id"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetBlockList retrieves list of blocks in the specified block blob.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Block-List
-func (b *Blob) GetBlockList(blockType BlockListType, options *GetBlockListOptions) (BlockListResponse, error) {
- params := url.Values{
- "comp": {"blocklist"},
- "blocklisttype": {string(blockType)},
- }
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- var out BlockListResponse
- resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return out, err
- }
- defer resp.Body.Close()
-
- err = xmlUnmarshal(resp.Body, &out)
- return out, err
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go
deleted file mode 100644
index ce6e5a80d8..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/client.go
+++ /dev/null
@@ -1,1061 +0,0 @@
-// Package storage provides clients for Microsoft Azure Storage Services.
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bufio"
- "encoding/base64"
- "encoding/json"
- "encoding/xml"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "mime"
- "mime/multipart"
- "net/http"
- "net/url"
- "regexp"
- "runtime"
- "strconv"
- "strings"
- "time"
-
- "github.com/Azure/azure-sdk-for-go/version"
- "github.com/Azure/go-autorest/autorest"
- "github.com/Azure/go-autorest/autorest/azure"
-)
-
-const (
- // DefaultBaseURL is the domain name used for storage requests in the
- // public cloud when a default client is created.
- DefaultBaseURL = "core.windows.net"
-
- // DefaultAPIVersion is the Azure Storage API version string used when a
- // basic client is created.
- DefaultAPIVersion = "2018-03-28"
-
- defaultUseHTTPS = true
- defaultRetryAttempts = 5
- defaultRetryDuration = time.Second * 5
-
- // StorageEmulatorAccountName is the fixed storage account used by Azure Storage Emulator
- StorageEmulatorAccountName = "devstoreaccount1"
-
- // StorageEmulatorAccountKey is the the fixed storage account used by Azure Storage Emulator
- StorageEmulatorAccountKey = "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
-
- blobServiceName = "blob"
- tableServiceName = "table"
- queueServiceName = "queue"
- fileServiceName = "file"
-
- storageEmulatorBlob = "127.0.0.1:10000"
- storageEmulatorTable = "127.0.0.1:10002"
- storageEmulatorQueue = "127.0.0.1:10001"
-
- userAgentHeader = "User-Agent"
-
- userDefinedMetadataHeaderPrefix = "x-ms-meta-"
-
- connectionStringAccountName = "accountname"
- connectionStringAccountKey = "accountkey"
- connectionStringEndpointSuffix = "endpointsuffix"
- connectionStringEndpointProtocol = "defaultendpointsprotocol"
-
- connectionStringBlobEndpoint = "blobendpoint"
- connectionStringFileEndpoint = "fileendpoint"
- connectionStringQueueEndpoint = "queueendpoint"
- connectionStringTableEndpoint = "tableendpoint"
- connectionStringSAS = "sharedaccesssignature"
-)
-
-var (
- validStorageAccount = regexp.MustCompile("^[0-9a-z]{3,24}$")
- validCosmosAccount = regexp.MustCompile("^[0-9a-z-]{3,44}$")
- defaultValidStatusCodes = []int{
- http.StatusRequestTimeout, // 408
- http.StatusInternalServerError, // 500
- http.StatusBadGateway, // 502
- http.StatusServiceUnavailable, // 503
- http.StatusGatewayTimeout, // 504
- }
-)
-
-// Sender sends a request
-type Sender interface {
- Send(*Client, *http.Request) (*http.Response, error)
-}
-
-// DefaultSender is the default sender for the client. It implements
-// an automatic retry strategy.
-type DefaultSender struct {
- RetryAttempts int
- RetryDuration time.Duration
- ValidStatusCodes []int
- attempts int // used for testing
-}
-
-// Send is the default retry strategy in the client
-func (ds *DefaultSender) Send(c *Client, req *http.Request) (resp *http.Response, err error) {
- rr := autorest.NewRetriableRequest(req)
- for attempts := 0; attempts < ds.RetryAttempts; attempts++ {
- err = rr.Prepare()
- if err != nil {
- return resp, err
- }
- resp, err = c.HTTPClient.Do(rr.Request())
- if err == nil && !autorest.ResponseHasStatusCode(resp, ds.ValidStatusCodes...) {
- return resp, err
- }
- drainRespBody(resp)
- autorest.DelayForBackoff(ds.RetryDuration, attempts, req.Cancel)
- ds.attempts = attempts
- }
- ds.attempts++
- return resp, err
-}
-
-// Client is the object that needs to be constructed to perform
-// operations on the storage account.
-type Client struct {
- // HTTPClient is the http.Client used to initiate API
- // requests. http.DefaultClient is used when creating a
- // client.
- HTTPClient *http.Client
-
- // Sender is an interface that sends the request. Clients are
- // created with a DefaultSender. The DefaultSender has an
- // automatic retry strategy built in. The Sender can be customized.
- Sender Sender
-
- accountName string
- accountKey []byte
- useHTTPS bool
- UseSharedKeyLite bool
- baseURL string
- apiVersion string
- userAgent string
- sasClient bool
- accountSASToken url.Values
- additionalHeaders map[string]string
-}
-
-type odataResponse struct {
- resp *http.Response
- odata odataErrorWrapper
-}
-
-// AzureStorageServiceError contains fields of the error response from
-// Azure Storage Service REST API. See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx
-// Some fields might be specific to certain calls.
-type AzureStorageServiceError struct {
- Code string `xml:"Code"`
- Message string `xml:"Message"`
- AuthenticationErrorDetail string `xml:"AuthenticationErrorDetail"`
- QueryParameterName string `xml:"QueryParameterName"`
- QueryParameterValue string `xml:"QueryParameterValue"`
- Reason string `xml:"Reason"`
- Lang string
- StatusCode int
- RequestID string
- Date string
- APIVersion string
-}
-
-// AzureTablesServiceError contains fields of the error response from
-// Azure Table Storage Service REST API in Atom format.
-// See https://msdn.microsoft.com/en-us/library/azure/dd179382.aspx
-type AzureTablesServiceError struct {
- Code string `xml:"code"`
- Message string `xml:"message"`
- StatusCode int
- RequestID string
- Date string
- APIVersion string
-}
-
-func (e AzureTablesServiceError) Error() string {
- return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestInitiated=%s, RequestId=%s, API Version=%s",
- e.StatusCode, e.Code, e.Message, e.Date, e.RequestID, e.APIVersion)
-}
-
-type odataErrorMessage struct {
- Lang string `json:"lang"`
- Value string `json:"value"`
-}
-
-type odataError struct {
- Code string `json:"code"`
- Message odataErrorMessage `json:"message"`
-}
-
-type odataErrorWrapper struct {
- Err odataError `json:"odata.error"`
-}
-
-// UnexpectedStatusCodeError is returned when a storage service responds with neither an error
-// nor with an HTTP status code indicating success.
-type UnexpectedStatusCodeError struct {
- allowed []int
- got int
- inner error
-}
-
-func (e UnexpectedStatusCodeError) Error() string {
- s := func(i int) string { return fmt.Sprintf("%d %s", i, http.StatusText(i)) }
-
- got := s(e.got)
- expected := []string{}
- for _, v := range e.allowed {
- expected = append(expected, s(v))
- }
- return fmt.Sprintf("storage: status code from service response is %s; was expecting %s. Inner error: %+v", got, strings.Join(expected, " or "), e.inner)
-}
-
-// Got is the actual status code returned by Azure.
-func (e UnexpectedStatusCodeError) Got() int {
- return e.got
-}
-
-// Inner returns any inner error info.
-func (e UnexpectedStatusCodeError) Inner() error {
- return e.inner
-}
-
-// NewClientFromConnectionString creates a Client from the connection string.
-func NewClientFromConnectionString(input string) (Client, error) {
- // build a map of connection string key/value pairs
- parts := map[string]string{}
- for _, pair := range strings.Split(input, ";") {
- if pair == "" {
- continue
- }
-
- equalDex := strings.IndexByte(pair, '=')
- if equalDex <= 0 {
- return Client{}, fmt.Errorf("Invalid connection segment %q", pair)
- }
-
- value := strings.TrimSpace(pair[equalDex+1:])
- key := strings.TrimSpace(strings.ToLower(pair[:equalDex]))
- parts[key] = value
- }
-
- // TODO: validate parameter sets?
-
- if parts[connectionStringAccountName] == StorageEmulatorAccountName {
- return NewEmulatorClient()
- }
-
- if parts[connectionStringSAS] != "" {
- endpoint := ""
- if parts[connectionStringBlobEndpoint] != "" {
- endpoint = parts[connectionStringBlobEndpoint]
- } else if parts[connectionStringFileEndpoint] != "" {
- endpoint = parts[connectionStringFileEndpoint]
- } else if parts[connectionStringQueueEndpoint] != "" {
- endpoint = parts[connectionStringQueueEndpoint]
- } else {
- endpoint = parts[connectionStringTableEndpoint]
- }
-
- return NewAccountSASClientFromEndpointToken(endpoint, parts[connectionStringSAS])
- }
-
- useHTTPS := defaultUseHTTPS
- if parts[connectionStringEndpointProtocol] != "" {
- useHTTPS = parts[connectionStringEndpointProtocol] == "https"
- }
-
- return NewClient(parts[connectionStringAccountName], parts[connectionStringAccountKey],
- parts[connectionStringEndpointSuffix], DefaultAPIVersion, useHTTPS)
-}
-
-// NewBasicClient constructs a Client with given storage service name and
-// key.
-func NewBasicClient(accountName, accountKey string) (Client, error) {
- if accountName == StorageEmulatorAccountName {
- return NewEmulatorClient()
- }
- return NewClient(accountName, accountKey, DefaultBaseURL, DefaultAPIVersion, defaultUseHTTPS)
-}
-
-// NewBasicClientOnSovereignCloud constructs a Client with given storage service name and
-// key in the referenced cloud.
-func NewBasicClientOnSovereignCloud(accountName, accountKey string, env azure.Environment) (Client, error) {
- if accountName == StorageEmulatorAccountName {
- return NewEmulatorClient()
- }
- return NewClient(accountName, accountKey, env.StorageEndpointSuffix, DefaultAPIVersion, defaultUseHTTPS)
-}
-
-//NewEmulatorClient contructs a Client intended to only work with Azure
-//Storage Emulator
-func NewEmulatorClient() (Client, error) {
- return NewClient(StorageEmulatorAccountName, StorageEmulatorAccountKey, DefaultBaseURL, DefaultAPIVersion, false)
-}
-
-// NewClient constructs a Client. This should be used if the caller wants
-// to specify whether to use HTTPS, a specific REST API version or a custom
-// storage endpoint than Azure Public Cloud.
-func NewClient(accountName, accountKey, serviceBaseURL, apiVersion string, useHTTPS bool) (Client, error) {
- var c Client
- if !IsValidStorageAccount(accountName) {
- return c, fmt.Errorf("azure: account name is not valid: it must be between 3 and 24 characters, and only may contain numbers and lowercase letters: %v", accountName)
- } else if accountKey == "" {
- return c, fmt.Errorf("azure: account key required")
- } else if serviceBaseURL == "" {
- return c, fmt.Errorf("azure: base storage service url required")
- }
-
- key, err := base64.StdEncoding.DecodeString(accountKey)
- if err != nil {
- return c, fmt.Errorf("azure: malformed storage account key: %v", err)
- }
-
- return newClient(accountName, key, serviceBaseURL, apiVersion, useHTTPS)
-}
-
-// NewCosmosClient constructs a Client for Azure CosmosDB. This should be used if the caller wants
-// to specify whether to use HTTPS, a specific REST API version or a custom
-// cosmos endpoint than Azure Public Cloud.
-func NewCosmosClient(accountName, accountKey, serviceBaseURL, apiVersion string, useHTTPS bool) (Client, error) {
- var c Client
- if !IsValidCosmosAccount(accountName) {
- return c, fmt.Errorf("azure: account name is not valid: The name can contain only lowercase letters, numbers and the '-' character, and must be between 3 and 44 characters: %v", accountName)
- } else if accountKey == "" {
- return c, fmt.Errorf("azure: account key required")
- } else if serviceBaseURL == "" {
- return c, fmt.Errorf("azure: base storage service url required")
- }
-
- key, err := base64.StdEncoding.DecodeString(accountKey)
- if err != nil {
- return c, fmt.Errorf("azure: malformed cosmos account key: %v", err)
- }
-
- return newClient(accountName, key, serviceBaseURL, apiVersion, useHTTPS)
-}
-
-// newClient constructs a Client with given parameters.
-func newClient(accountName string, accountKey []byte, serviceBaseURL, apiVersion string, useHTTPS bool) (Client, error) {
- c := Client{
- HTTPClient: http.DefaultClient,
- accountName: accountName,
- accountKey: accountKey,
- useHTTPS: useHTTPS,
- baseURL: serviceBaseURL,
- apiVersion: apiVersion,
- sasClient: false,
- UseSharedKeyLite: false,
- Sender: &DefaultSender{
- RetryAttempts: defaultRetryAttempts,
- ValidStatusCodes: defaultValidStatusCodes,
- RetryDuration: defaultRetryDuration,
- },
- }
- c.userAgent = c.getDefaultUserAgent()
- return c, nil
-}
-
-// IsValidStorageAccount checks if the storage account name is valid.
-// See https://docs.microsoft.com/en-us/azure/storage/storage-create-storage-account
-func IsValidStorageAccount(account string) bool {
- return validStorageAccount.MatchString(account)
-}
-
-// IsValidCosmosAccount checks if the Cosmos account name is valid.
-// See https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-database-account
-func IsValidCosmosAccount(account string) bool {
- return validCosmosAccount.MatchString(account)
-}
-
-// NewAccountSASClient contructs a client that uses accountSAS authorization
-// for its operations.
-func NewAccountSASClient(account string, token url.Values, env azure.Environment) Client {
- return newSASClient(account, env.StorageEndpointSuffix, token)
-}
-
-// NewAccountSASClientFromEndpointToken constructs a client that uses accountSAS authorization
-// for its operations using the specified endpoint and SAS token.
-func NewAccountSASClientFromEndpointToken(endpoint string, sasToken string) (Client, error) {
- u, err := url.Parse(endpoint)
- if err != nil {
- return Client{}, err
- }
- _, err = url.ParseQuery(sasToken)
- if err != nil {
- return Client{}, err
- }
- u.RawQuery = sasToken
- return newSASClientFromURL(u)
-}
-
-func newSASClient(accountName, baseURL string, sasToken url.Values) Client {
- c := Client{
- HTTPClient: http.DefaultClient,
- apiVersion: DefaultAPIVersion,
- sasClient: true,
- Sender: &DefaultSender{
- RetryAttempts: defaultRetryAttempts,
- ValidStatusCodes: defaultValidStatusCodes,
- RetryDuration: defaultRetryDuration,
- },
- accountName: accountName,
- baseURL: baseURL,
- accountSASToken: sasToken,
- useHTTPS: defaultUseHTTPS,
- }
- c.userAgent = c.getDefaultUserAgent()
- // Get API version and protocol from token
- c.apiVersion = sasToken.Get("sv")
- if spr := sasToken.Get("spr"); spr != "" {
- c.useHTTPS = spr == "https"
- }
- return c
-}
-
-func newSASClientFromURL(u *url.URL) (Client, error) {
- // the host name will look something like this
- // - foo.blob.core.windows.net
- // "foo" is the account name
- // "core.windows.net" is the baseURL
-
- // find the first dot to get account name
- i1 := strings.IndexByte(u.Host, '.')
- if i1 < 0 {
- return Client{}, fmt.Errorf("failed to find '.' in %s", u.Host)
- }
-
- // now find the second dot to get the base URL
- i2 := strings.IndexByte(u.Host[i1+1:], '.')
- if i2 < 0 {
- return Client{}, fmt.Errorf("failed to find '.' in %s", u.Host[i1+1:])
- }
-
- sasToken := u.Query()
- c := newSASClient(u.Host[:i1], u.Host[i1+i2+2:], sasToken)
- if spr := sasToken.Get("spr"); spr == "" {
- // infer from URL if not in the query params set
- c.useHTTPS = u.Scheme == "https"
- }
- return c, nil
-}
-
-func (c Client) isServiceSASClient() bool {
- return c.sasClient && c.accountSASToken == nil
-}
-
-func (c Client) isAccountSASClient() bool {
- return c.sasClient && c.accountSASToken != nil
-}
-
-func (c Client) getDefaultUserAgent() string {
- return fmt.Sprintf("Go/%s (%s-%s) azure-storage-go/%s api-version/%s",
- runtime.Version(),
- runtime.GOARCH,
- runtime.GOOS,
- version.Number,
- c.apiVersion,
- )
-}
-
-// AddToUserAgent adds an extension to the current user agent
-func (c *Client) AddToUserAgent(extension string) error {
- if extension != "" {
- c.userAgent = fmt.Sprintf("%s %s", c.userAgent, extension)
- return nil
- }
- return fmt.Errorf("Extension was empty, User Agent stayed as %s", c.userAgent)
-}
-
-// AddAdditionalHeaders adds additional standard headers
-func (c *Client) AddAdditionalHeaders(headers map[string]string) {
- if headers != nil {
- c.additionalHeaders = map[string]string{}
- for k, v := range headers {
- c.additionalHeaders[k] = v
- }
- }
-}
-
-// protectUserAgent is used in funcs that include extraheaders as a parameter.
-// It prevents the User-Agent header to be overwritten, instead if it happens to
-// be present, it gets added to the current User-Agent. Use it before getStandardHeaders
-func (c *Client) protectUserAgent(extraheaders map[string]string) map[string]string {
- if v, ok := extraheaders[userAgentHeader]; ok {
- c.AddToUserAgent(v)
- delete(extraheaders, userAgentHeader)
- }
- return extraheaders
-}
-
-func (c Client) getBaseURL(service string) *url.URL {
- scheme := "http"
- if c.useHTTPS {
- scheme = "https"
- }
- host := ""
- if c.accountName == StorageEmulatorAccountName {
- switch service {
- case blobServiceName:
- host = storageEmulatorBlob
- case tableServiceName:
- host = storageEmulatorTable
- case queueServiceName:
- host = storageEmulatorQueue
- }
- } else {
- host = fmt.Sprintf("%s.%s.%s", c.accountName, service, c.baseURL)
- }
-
- return &url.URL{
- Scheme: scheme,
- Host: host,
- }
-}
-
-func (c Client) getEndpoint(service, path string, params url.Values) string {
- u := c.getBaseURL(service)
-
- // API doesn't accept path segments not starting with '/'
- if !strings.HasPrefix(path, "/") {
- path = fmt.Sprintf("/%v", path)
- }
-
- if c.accountName == StorageEmulatorAccountName {
- path = fmt.Sprintf("/%v%v", StorageEmulatorAccountName, path)
- }
-
- u.Path = path
- u.RawQuery = params.Encode()
- return u.String()
-}
-
-// AccountSASTokenOptions includes options for constructing
-// an account SAS token.
-// https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
-type AccountSASTokenOptions struct {
- APIVersion string
- Services Services
- ResourceTypes ResourceTypes
- Permissions Permissions
- Start time.Time
- Expiry time.Time
- IP string
- UseHTTPS bool
-}
-
-// Services specify services accessible with an account SAS.
-type Services struct {
- Blob bool
- Queue bool
- Table bool
- File bool
-}
-
-// ResourceTypes specify the resources accesible with an
-// account SAS.
-type ResourceTypes struct {
- Service bool
- Container bool
- Object bool
-}
-
-// Permissions specifies permissions for an accountSAS.
-type Permissions struct {
- Read bool
- Write bool
- Delete bool
- List bool
- Add bool
- Create bool
- Update bool
- Process bool
-}
-
-// GetAccountSASToken creates an account SAS token
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas
-func (c Client) GetAccountSASToken(options AccountSASTokenOptions) (url.Values, error) {
- if options.APIVersion == "" {
- options.APIVersion = c.apiVersion
- }
-
- if options.APIVersion < "2015-04-05" {
- return url.Values{}, fmt.Errorf("account SAS does not support API versions prior to 2015-04-05. API version : %s", options.APIVersion)
- }
-
- // build services string
- services := ""
- if options.Services.Blob {
- services += "b"
- }
- if options.Services.Queue {
- services += "q"
- }
- if options.Services.Table {
- services += "t"
- }
- if options.Services.File {
- services += "f"
- }
-
- // build resources string
- resources := ""
- if options.ResourceTypes.Service {
- resources += "s"
- }
- if options.ResourceTypes.Container {
- resources += "c"
- }
- if options.ResourceTypes.Object {
- resources += "o"
- }
-
- // build permissions string
- permissions := ""
- if options.Permissions.Read {
- permissions += "r"
- }
- if options.Permissions.Write {
- permissions += "w"
- }
- if options.Permissions.Delete {
- permissions += "d"
- }
- if options.Permissions.List {
- permissions += "l"
- }
- if options.Permissions.Add {
- permissions += "a"
- }
- if options.Permissions.Create {
- permissions += "c"
- }
- if options.Permissions.Update {
- permissions += "u"
- }
- if options.Permissions.Process {
- permissions += "p"
- }
-
- // build start time, if exists
- start := ""
- if options.Start != (time.Time{}) {
- start = options.Start.UTC().Format(time.RFC3339)
- }
-
- // build expiry time
- expiry := options.Expiry.UTC().Format(time.RFC3339)
-
- protocol := "https,http"
- if options.UseHTTPS {
- protocol = "https"
- }
-
- stringToSign := strings.Join([]string{
- c.accountName,
- permissions,
- services,
- resources,
- start,
- expiry,
- options.IP,
- protocol,
- options.APIVersion,
- "",
- }, "\n")
- signature := c.computeHmac256(stringToSign)
-
- sasParams := url.Values{
- "sv": {options.APIVersion},
- "ss": {services},
- "srt": {resources},
- "sp": {permissions},
- "se": {expiry},
- "spr": {protocol},
- "sig": {signature},
- }
- if start != "" {
- sasParams.Add("st", start)
- }
- if options.IP != "" {
- sasParams.Add("sip", options.IP)
- }
-
- return sasParams, nil
-}
-
-// GetBlobService returns a BlobStorageClient which can operate on the blob
-// service of the storage account.
-func (c Client) GetBlobService() BlobStorageClient {
- b := BlobStorageClient{
- client: c,
- }
- b.client.AddToUserAgent(blobServiceName)
- b.auth = sharedKey
- if c.UseSharedKeyLite {
- b.auth = sharedKeyLite
- }
- return b
-}
-
-// GetQueueService returns a QueueServiceClient which can operate on the queue
-// service of the storage account.
-func (c Client) GetQueueService() QueueServiceClient {
- q := QueueServiceClient{
- client: c,
- }
- q.client.AddToUserAgent(queueServiceName)
- q.auth = sharedKey
- if c.UseSharedKeyLite {
- q.auth = sharedKeyLite
- }
- return q
-}
-
-// GetTableService returns a TableServiceClient which can operate on the table
-// service of the storage account.
-func (c Client) GetTableService() TableServiceClient {
- t := TableServiceClient{
- client: c,
- }
- t.client.AddToUserAgent(tableServiceName)
- t.auth = sharedKeyForTable
- if c.UseSharedKeyLite {
- t.auth = sharedKeyLiteForTable
- }
- return t
-}
-
-// GetFileService returns a FileServiceClient which can operate on the file
-// service of the storage account.
-func (c Client) GetFileService() FileServiceClient {
- f := FileServiceClient{
- client: c,
- }
- f.client.AddToUserAgent(fileServiceName)
- f.auth = sharedKey
- if c.UseSharedKeyLite {
- f.auth = sharedKeyLite
- }
- return f
-}
-
-func (c Client) getStandardHeaders() map[string]string {
- headers := map[string]string{}
- for k, v := range c.additionalHeaders {
- headers[k] = v
- }
-
- headers[userAgentHeader] = c.userAgent
- headers["x-ms-version"] = c.apiVersion
- headers["x-ms-date"] = currentTimeRfc1123Formatted()
-
- return headers
-}
-
-func (c Client) exec(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*http.Response, error) {
- headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
- if err != nil {
- return nil, err
- }
-
- req, err := http.NewRequest(verb, url, body)
- if err != nil {
- return nil, errors.New("azure/storage: error creating request: " + err.Error())
- }
-
- // http.NewRequest() will automatically set req.ContentLength for a handful of types
- // otherwise we will handle here.
- if req.ContentLength < 1 {
- if clstr, ok := headers["Content-Length"]; ok {
- if cl, err := strconv.ParseInt(clstr, 10, 64); err == nil {
- req.ContentLength = cl
- }
- }
- }
-
- for k, v := range headers {
- req.Header[k] = append(req.Header[k], v) // Must bypass case munging present in `Add` by using map functions directly. See https://github.com/Azure/azure-sdk-for-go/issues/645
- }
-
- if c.isAccountSASClient() {
- // append the SAS token to the query params
- v := req.URL.Query()
- v = mergeParams(v, c.accountSASToken)
- req.URL.RawQuery = v.Encode()
- }
-
- resp, err := c.Sender.Send(&c, req)
- if err != nil {
- return nil, err
- }
-
- if resp.StatusCode >= 400 && resp.StatusCode <= 505 {
- return resp, getErrorFromResponse(resp)
- }
-
- return resp, nil
-}
-
-func (c Client) execInternalJSONCommon(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, *http.Request, *http.Response, error) {
- headers, err := c.addAuthorizationHeader(verb, url, headers, auth)
- if err != nil {
- return nil, nil, nil, err
- }
-
- req, err := http.NewRequest(verb, url, body)
- for k, v := range headers {
- req.Header.Add(k, v)
- }
-
- resp, err := c.Sender.Send(&c, req)
- if err != nil {
- return nil, nil, nil, err
- }
-
- respToRet := &odataResponse{resp: resp}
-
- statusCode := resp.StatusCode
- if statusCode >= 400 && statusCode <= 505 {
- var respBody []byte
- respBody, err = readAndCloseBody(resp.Body)
- if err != nil {
- return nil, nil, nil, err
- }
-
- requestID, date, version := getDebugHeaders(resp.Header)
- if len(respBody) == 0 {
- // no error in response body, might happen in HEAD requests
- err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version)
- return respToRet, req, resp, err
- }
- // response contains storage service error object, unmarshal
- if resp.Header.Get("Content-Type") == "application/xml" {
- storageErr := AzureTablesServiceError{
- StatusCode: resp.StatusCode,
- RequestID: requestID,
- Date: date,
- APIVersion: version,
- }
- if err := xml.Unmarshal(respBody, &storageErr); err != nil {
- storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(respBody))
- }
- err = storageErr
- } else {
- err = json.Unmarshal(respBody, &respToRet.odata)
- }
- }
-
- return respToRet, req, resp, err
-}
-
-func (c Client) execInternalJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) {
- respToRet, _, _, err := c.execInternalJSONCommon(verb, url, headers, body, auth)
- return respToRet, err
-}
-
-func (c Client) execBatchOperationJSON(verb, url string, headers map[string]string, body io.Reader, auth authentication) (*odataResponse, error) {
- // execute common query, get back generated request, response etc... for more processing.
- respToRet, req, resp, err := c.execInternalJSONCommon(verb, url, headers, body, auth)
- if err != nil {
- return nil, err
- }
-
- // return the OData in the case of executing batch commands.
- // In this case we need to read the outer batch boundary and contents.
- // Then we read the changeset information within the batch
- var respBody []byte
- respBody, err = readAndCloseBody(resp.Body)
- if err != nil {
- return nil, err
- }
-
- // outer multipart body
- _, batchHeader, err := mime.ParseMediaType(resp.Header["Content-Type"][0])
- if err != nil {
- return nil, err
- }
-
- // batch details.
- batchBoundary := batchHeader["boundary"]
- batchPartBuf, changesetBoundary, err := genBatchReader(batchBoundary, respBody)
- if err != nil {
- return nil, err
- }
-
- // changeset details.
- err = genChangesetReader(req, respToRet, batchPartBuf, changesetBoundary)
- if err != nil {
- return nil, err
- }
-
- return respToRet, nil
-}
-
-func genChangesetReader(req *http.Request, respToRet *odataResponse, batchPartBuf io.Reader, changesetBoundary string) error {
- changesetMultiReader := multipart.NewReader(batchPartBuf, changesetBoundary)
- changesetPart, err := changesetMultiReader.NextPart()
- if err != nil {
- return err
- }
-
- changesetPartBufioReader := bufio.NewReader(changesetPart)
- changesetResp, err := http.ReadResponse(changesetPartBufioReader, req)
- if err != nil {
- return err
- }
-
- if changesetResp.StatusCode != http.StatusNoContent {
- changesetBody, err := readAndCloseBody(changesetResp.Body)
- err = json.Unmarshal(changesetBody, &respToRet.odata)
- if err != nil {
- return err
- }
- respToRet.resp = changesetResp
- }
-
- return nil
-}
-
-func genBatchReader(batchBoundary string, respBody []byte) (io.Reader, string, error) {
- respBodyString := string(respBody)
- respBodyReader := strings.NewReader(respBodyString)
-
- // reading batchresponse
- batchMultiReader := multipart.NewReader(respBodyReader, batchBoundary)
- batchPart, err := batchMultiReader.NextPart()
- if err != nil {
- return nil, "", err
- }
- batchPartBufioReader := bufio.NewReader(batchPart)
-
- _, changesetHeader, err := mime.ParseMediaType(batchPart.Header.Get("Content-Type"))
- if err != nil {
- return nil, "", err
- }
- changesetBoundary := changesetHeader["boundary"]
- return batchPartBufioReader, changesetBoundary, nil
-}
-
-func readAndCloseBody(body io.ReadCloser) ([]byte, error) {
- defer body.Close()
- out, err := ioutil.ReadAll(body)
- if err == io.EOF {
- err = nil
- }
- return out, err
-}
-
-// reads the response body then closes it
-func drainRespBody(resp *http.Response) {
- if resp != nil {
- io.Copy(ioutil.Discard, resp.Body)
- resp.Body.Close()
- }
-}
-
-func serviceErrFromXML(body []byte, storageErr *AzureStorageServiceError) error {
- if err := xml.Unmarshal(body, storageErr); err != nil {
- storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body))
- return err
- }
- return nil
-}
-
-func serviceErrFromJSON(body []byte, storageErr *AzureStorageServiceError) error {
- odataError := odataErrorWrapper{}
- if err := json.Unmarshal(body, &odataError); err != nil {
- storageErr.Message = fmt.Sprintf("Response body could no be unmarshaled: %v. Body: %v.", err, string(body))
- return err
- }
- storageErr.Code = odataError.Err.Code
- storageErr.Message = odataError.Err.Message.Value
- storageErr.Lang = odataError.Err.Message.Lang
- return nil
-}
-
-func serviceErrFromStatusCode(code int, status string, requestID, date, version string) AzureStorageServiceError {
- return AzureStorageServiceError{
- StatusCode: code,
- Code: status,
- RequestID: requestID,
- Date: date,
- APIVersion: version,
- Message: "no response body was available for error status code",
- }
-}
-
-func (e AzureStorageServiceError) Error() string {
- return fmt.Sprintf("storage: service returned error: StatusCode=%d, ErrorCode=%s, ErrorMessage=%s, RequestInitiated=%s, RequestId=%s, API Version=%s, QueryParameterName=%s, QueryParameterValue=%s",
- e.StatusCode, e.Code, e.Message, e.Date, e.RequestID, e.APIVersion, e.QueryParameterName, e.QueryParameterValue)
-}
-
-// checkRespCode returns UnexpectedStatusError if the given response code is not
-// one of the allowed status codes; otherwise nil.
-func checkRespCode(resp *http.Response, allowed []int) error {
- for _, v := range allowed {
- if resp.StatusCode == v {
- return nil
- }
- }
- err := getErrorFromResponse(resp)
- return UnexpectedStatusCodeError{
- allowed: allowed,
- got: resp.StatusCode,
- inner: err,
- }
-}
-
-func (c Client) addMetadataToHeaders(h map[string]string, metadata map[string]string) map[string]string {
- metadata = c.protectUserAgent(metadata)
- for k, v := range metadata {
- h[userDefinedMetadataHeaderPrefix+k] = v
- }
- return h
-}
-
-func getDebugHeaders(h http.Header) (requestID, date, version string) {
- requestID = h.Get("x-ms-request-id")
- version = h.Get("x-ms-version")
- date = h.Get("Date")
- return
-}
-
-func getErrorFromResponse(resp *http.Response) error {
- respBody, err := readAndCloseBody(resp.Body)
- if err != nil {
- return err
- }
-
- requestID, date, version := getDebugHeaders(resp.Header)
- if len(respBody) == 0 {
- // no error in response body, might happen in HEAD requests
- err = serviceErrFromStatusCode(resp.StatusCode, resp.Status, requestID, date, version)
- } else {
- storageErr := AzureStorageServiceError{
- StatusCode: resp.StatusCode,
- RequestID: requestID,
- Date: date,
- APIVersion: version,
- }
- // response contains storage service error object, unmarshal
- if resp.Header.Get("Content-Type") == "application/xml" {
- errIn := serviceErrFromXML(respBody, &storageErr)
- if err != nil { // error unmarshaling the error response
- err = errIn
- }
- } else {
- errIn := serviceErrFromJSON(respBody, &storageErr)
- if err != nil { // error unmarshaling the error response
- err = errIn
- }
- }
- err = storageErr
- }
- return err
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/commonsasuri.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/commonsasuri.go
deleted file mode 100644
index a203fce8d4..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/commonsasuri.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "net/url"
- "time"
-)
-
-// SASOptions includes options used by SAS URIs for different
-// services and resources.
-type SASOptions struct {
- APIVersion string
- Start time.Time
- Expiry time.Time
- IP string
- UseHTTPS bool
- Identifier string
-}
-
-func addQueryParameter(query url.Values, key, value string) url.Values {
- if value != "" {
- query.Add(key, value)
- }
- return query
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go
deleted file mode 100644
index ae2862c868..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/container.go
+++ /dev/null
@@ -1,629 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-// Container represents an Azure container.
-type Container struct {
- bsc *BlobStorageClient
- Name string `xml:"Name"`
- Properties ContainerProperties `xml:"Properties"`
- Metadata map[string]string
- sasuri url.URL
-}
-
-// Client returns the HTTP client used by the Container reference.
-func (c *Container) Client() *Client {
- return &c.bsc.client
-}
-
-func (c *Container) buildPath() string {
- return fmt.Sprintf("/%s", c.Name)
-}
-
-// GetURL gets the canonical URL to the container.
-// This method does not create a publicly accessible URL if the container
-// is private and this method does not check if the blob exists.
-func (c *Container) GetURL() string {
- container := c.Name
- if container == "" {
- container = "$root"
- }
- return c.bsc.client.getEndpoint(blobServiceName, pathForResource(container, ""), nil)
-}
-
-// ContainerSASOptions are options to construct a container SAS
-// URI.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-type ContainerSASOptions struct {
- ContainerSASPermissions
- OverrideHeaders
- SASOptions
-}
-
-// ContainerSASPermissions includes the available permissions for
-// a container SAS URI.
-type ContainerSASPermissions struct {
- BlobServiceSASPermissions
- List bool
-}
-
-// GetSASURI creates an URL to the container which contains the Shared
-// Access Signature with the specified options.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-func (c *Container) GetSASURI(options ContainerSASOptions) (string, error) {
- uri := c.GetURL()
- signedResource := "c"
- canonicalizedResource, err := c.bsc.client.buildCanonicalizedResource(uri, c.bsc.auth, true)
- if err != nil {
- return "", err
- }
-
- // build permissions string
- permissions := options.BlobServiceSASPermissions.buildString()
- if options.List {
- permissions += "l"
- }
-
- return c.bsc.client.blobAndFileSASURI(options.SASOptions, uri, permissions, canonicalizedResource, signedResource, options.OverrideHeaders)
-}
-
-// ContainerProperties contains various properties of a container returned from
-// various endpoints like ListContainers.
-type ContainerProperties struct {
- LastModified string `xml:"Last-Modified"`
- Etag string `xml:"Etag"`
- LeaseStatus string `xml:"LeaseStatus"`
- LeaseState string `xml:"LeaseState"`
- LeaseDuration string `xml:"LeaseDuration"`
- PublicAccess ContainerAccessType `xml:"PublicAccess"`
-}
-
-// ContainerListResponse contains the response fields from
-// ListContainers call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179352.aspx
-type ContainerListResponse struct {
- XMLName xml.Name `xml:"EnumerationResults"`
- Xmlns string `xml:"xmlns,attr"`
- Prefix string `xml:"Prefix"`
- Marker string `xml:"Marker"`
- NextMarker string `xml:"NextMarker"`
- MaxResults int64 `xml:"MaxResults"`
- Containers []Container `xml:"Containers>Container"`
-}
-
-// BlobListResponse contains the response fields from ListBlobs call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx
-type BlobListResponse struct {
- XMLName xml.Name `xml:"EnumerationResults"`
- Xmlns string `xml:"xmlns,attr"`
- Prefix string `xml:"Prefix"`
- Marker string `xml:"Marker"`
- NextMarker string `xml:"NextMarker"`
- MaxResults int64 `xml:"MaxResults"`
- Blobs []Blob `xml:"Blobs>Blob"`
-
- // BlobPrefix is used to traverse blobs as if it were a file system.
- // It is returned if ListBlobsParameters.Delimiter is specified.
- // The list here can be thought of as "folders" that may contain
- // other folders or blobs.
- BlobPrefixes []string `xml:"Blobs>BlobPrefix>Name"`
-
- // Delimiter is used to traverse blobs as if it were a file system.
- // It is returned if ListBlobsParameters.Delimiter is specified.
- Delimiter string `xml:"Delimiter"`
-}
-
-// IncludeBlobDataset has options to include in a list blobs operation
-type IncludeBlobDataset struct {
- Snapshots bool
- Metadata bool
- UncommittedBlobs bool
- Copy bool
-}
-
-// ListBlobsParameters defines the set of customizable
-// parameters to make a List Blobs call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd135734.aspx
-type ListBlobsParameters struct {
- Prefix string
- Delimiter string
- Marker string
- Include *IncludeBlobDataset
- MaxResults uint
- Timeout uint
- RequestID string
-}
-
-func (p ListBlobsParameters) getParameters() url.Values {
- out := url.Values{}
-
- if p.Prefix != "" {
- out.Set("prefix", p.Prefix)
- }
- if p.Delimiter != "" {
- out.Set("delimiter", p.Delimiter)
- }
- if p.Marker != "" {
- out.Set("marker", p.Marker)
- }
- if p.Include != nil {
- include := []string{}
- include = addString(include, p.Include.Snapshots, "snapshots")
- include = addString(include, p.Include.Metadata, "metadata")
- include = addString(include, p.Include.UncommittedBlobs, "uncommittedblobs")
- include = addString(include, p.Include.Copy, "copy")
- fullInclude := strings.Join(include, ",")
- out.Set("include", fullInclude)
- }
- if p.MaxResults != 0 {
- out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10))
- }
- if p.Timeout != 0 {
- out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10))
- }
-
- return out
-}
-
-func addString(datasets []string, include bool, text string) []string {
- if include {
- datasets = append(datasets, text)
- }
- return datasets
-}
-
-// ContainerAccessType defines the access level to the container from a public
-// request.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179468.aspx and "x-ms-
-// blob-public-access" header.
-type ContainerAccessType string
-
-// Access options for containers
-const (
- ContainerAccessTypePrivate ContainerAccessType = ""
- ContainerAccessTypeBlob ContainerAccessType = "blob"
- ContainerAccessTypeContainer ContainerAccessType = "container"
-)
-
-// ContainerAccessPolicy represents each access policy in the container ACL.
-type ContainerAccessPolicy struct {
- ID string
- StartTime time.Time
- ExpiryTime time.Time
- CanRead bool
- CanWrite bool
- CanDelete bool
-}
-
-// ContainerPermissions represents the container ACLs.
-type ContainerPermissions struct {
- AccessType ContainerAccessType
- AccessPolicies []ContainerAccessPolicy
-}
-
-// ContainerAccessHeader references header used when setting/getting container ACL
-const (
- ContainerAccessHeader string = "x-ms-blob-public-access"
-)
-
-// GetBlobReference returns a Blob object for the specified blob name.
-func (c *Container) GetBlobReference(name string) *Blob {
- return &Blob{
- Container: c,
- Name: name,
- }
-}
-
-// CreateContainerOptions includes the options for a create container operation
-type CreateContainerOptions struct {
- Timeout uint
- Access ContainerAccessType `header:"x-ms-blob-public-access"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Create creates a blob container within the storage account
-// with given name and access level. Returns error if container already exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Container
-func (c *Container) Create(options *CreateContainerOptions) error {
- resp, err := c.create(options)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusCreated})
-}
-
-// CreateIfNotExists creates a blob container if it does not exist. Returns
-// true if container is newly created or false if container already exists.
-func (c *Container) CreateIfNotExists(options *CreateContainerOptions) (bool, error) {
- resp, err := c.create(options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict {
- return resp.StatusCode == http.StatusCreated, nil
- }
- }
- return false, err
-}
-
-func (c *Container) create(options *CreateContainerOptions) (*http.Response, error) {
- query := url.Values{"restype": {"container"}}
- headers := c.bsc.client.getStandardHeaders()
- headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata)
-
- if options != nil {
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query)
-
- return c.bsc.client.exec(http.MethodPut, uri, headers, nil, c.bsc.auth)
-}
-
-// Exists returns true if a container with given name exists
-// on the storage account, otherwise returns false.
-func (c *Container) Exists() (bool, error) {
- q := url.Values{"restype": {"container"}}
- var uri string
- if c.bsc.client.isServiceSASClient() {
- q = mergeParams(q, c.sasuri.Query())
- newURI := c.sasuri
- newURI.RawQuery = q.Encode()
- uri = newURI.String()
-
- } else {
- uri = c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), q)
- }
- headers := c.bsc.client.getStandardHeaders()
-
- resp, err := c.bsc.client.exec(http.MethodHead, uri, headers, nil, c.bsc.auth)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusOK, nil
- }
- }
- return false, err
-}
-
-// SetContainerPermissionOptions includes options for a set container permissions operation
-type SetContainerPermissionOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// SetPermissions sets up container permissions
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Container-ACL
-func (c *Container) SetPermissions(permissions ContainerPermissions, options *SetContainerPermissionOptions) error {
- body, length, err := generateContainerACLpayload(permissions.AccessPolicies)
- if err != nil {
- return err
- }
- params := url.Values{
- "restype": {"container"},
- "comp": {"acl"},
- }
- headers := c.bsc.client.getStandardHeaders()
- headers = addToHeaders(headers, ContainerAccessHeader, string(permissions.AccessType))
- headers["Content-Length"] = strconv.Itoa(length)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
-
- resp, err := c.bsc.client.exec(http.MethodPut, uri, headers, body, c.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusOK})
-}
-
-// GetContainerPermissionOptions includes options for a get container permissions operation
-type GetContainerPermissionOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetPermissions gets the container permissions as per https://msdn.microsoft.com/en-us/library/azure/dd179469.aspx
-// If timeout is 0 then it will not be passed to Azure
-// leaseID will only be passed to Azure if populated
-func (c *Container) GetPermissions(options *GetContainerPermissionOptions) (*ContainerPermissions, error) {
- params := url.Values{
- "restype": {"container"},
- "comp": {"acl"},
- }
- headers := c.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
-
- resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- var ap AccessPolicy
- err = xmlUnmarshal(resp.Body, &ap.SignedIdentifiersList)
- if err != nil {
- return nil, err
- }
- return buildAccessPolicy(ap, &resp.Header), nil
-}
-
-func buildAccessPolicy(ap AccessPolicy, headers *http.Header) *ContainerPermissions {
- // containerAccess. Blob, Container, empty
- containerAccess := headers.Get(http.CanonicalHeaderKey(ContainerAccessHeader))
- permissions := ContainerPermissions{
- AccessType: ContainerAccessType(containerAccess),
- AccessPolicies: []ContainerAccessPolicy{},
- }
-
- for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers {
- capd := ContainerAccessPolicy{
- ID: policy.ID,
- StartTime: policy.AccessPolicy.StartTime,
- ExpiryTime: policy.AccessPolicy.ExpiryTime,
- }
- capd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r")
- capd.CanWrite = updatePermissions(policy.AccessPolicy.Permission, "w")
- capd.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d")
-
- permissions.AccessPolicies = append(permissions.AccessPolicies, capd)
- }
- return &permissions
-}
-
-// DeleteContainerOptions includes options for a delete container operation
-type DeleteContainerOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Delete deletes the container with given name on the storage
-// account. If the container does not exist returns error.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container
-func (c *Container) Delete(options *DeleteContainerOptions) error {
- resp, err := c.delete(options)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusAccepted})
-}
-
-// DeleteIfExists deletes the container with given name on the storage
-// account if it exists. Returns true if container is deleted with this call, or
-// false if the container did not exist at the time of the Delete Container
-// operation.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-container
-func (c *Container) DeleteIfExists(options *DeleteContainerOptions) (bool, error) {
- resp, err := c.delete(options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusAccepted, nil
- }
- }
- return false, err
-}
-
-func (c *Container) delete(options *DeleteContainerOptions) (*http.Response, error) {
- query := url.Values{"restype": {"container"}}
- headers := c.bsc.client.getStandardHeaders()
-
- if options != nil {
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), query)
-
- return c.bsc.client.exec(http.MethodDelete, uri, headers, nil, c.bsc.auth)
-}
-
-// ListBlobs returns an object that contains list of blobs in the container,
-// pagination token and other information in the response of List Blobs call.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Blobs
-func (c *Container) ListBlobs(params ListBlobsParameters) (BlobListResponse, error) {
- q := mergeParams(params.getParameters(), url.Values{
- "restype": {"container"},
- "comp": {"list"},
- })
- var uri string
- if c.bsc.client.isServiceSASClient() {
- q = mergeParams(q, c.sasuri.Query())
- newURI := c.sasuri
- newURI.RawQuery = q.Encode()
- uri = newURI.String()
- } else {
- uri = c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), q)
- }
-
- headers := c.bsc.client.getStandardHeaders()
- headers = addToHeaders(headers, "x-ms-client-request-id", params.RequestID)
-
- var out BlobListResponse
- resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth)
- if err != nil {
- return out, err
- }
- defer resp.Body.Close()
-
- err = xmlUnmarshal(resp.Body, &out)
- for i := range out.Blobs {
- out.Blobs[i].Container = c
- }
- return out, err
-}
-
-// ContainerMetadataOptions includes options for container metadata operations
-type ContainerMetadataOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// SetMetadata replaces the metadata for the specified container.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetBlobMetadata. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/set-container-metadata
-func (c *Container) SetMetadata(options *ContainerMetadataOptions) error {
- params := url.Values{
- "comp": {"metadata"},
- "restype": {"container"},
- }
- headers := c.bsc.client.getStandardHeaders()
- headers = c.bsc.client.addMetadataToHeaders(headers, c.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
-
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
-
- resp, err := c.bsc.client.exec(http.MethodPut, uri, headers, nil, c.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusOK})
-}
-
-// GetMetadata returns all user-defined metadata for the specified container.
-//
-// All metadata keys will be returned in lower case. (HTTP header
-// names are case-insensitive.)
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-metadata
-func (c *Container) GetMetadata(options *ContainerMetadataOptions) error {
- params := url.Values{
- "comp": {"metadata"},
- "restype": {"container"},
- }
- headers := c.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
-
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
-
- resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- c.writeMetadata(resp.Header)
- return nil
-}
-
-func (c *Container) writeMetadata(h http.Header) {
- c.Metadata = writeMetadata(h)
-}
-
-func generateContainerACLpayload(policies []ContainerAccessPolicy) (io.Reader, int, error) {
- sil := SignedIdentifiers{
- SignedIdentifiers: []SignedIdentifier{},
- }
- for _, capd := range policies {
- permission := capd.generateContainerPermissions()
- signedIdentifier := convertAccessPolicyToXMLStructs(capd.ID, capd.StartTime, capd.ExpiryTime, permission)
- sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier)
- }
- return xmlMarshal(sil)
-}
-
-func (capd *ContainerAccessPolicy) generateContainerPermissions() (permissions string) {
- // generate the permissions string (rwd).
- // still want the end user API to have bool flags.
- permissions = ""
-
- if capd.CanRead {
- permissions += "r"
- }
-
- if capd.CanWrite {
- permissions += "w"
- }
-
- if capd.CanDelete {
- permissions += "d"
- }
-
- return permissions
-}
-
-// GetProperties updated the properties of the container.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/get-container-properties
-func (c *Container) GetProperties() error {
- params := url.Values{
- "restype": {"container"},
- }
- headers := c.bsc.client.getStandardHeaders()
-
- uri := c.bsc.client.getEndpoint(blobServiceName, c.buildPath(), params)
-
- resp, err := c.bsc.client.exec(http.MethodGet, uri, headers, nil, c.bsc.auth)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- // update properties
- c.Properties.Etag = resp.Header.Get(headerEtag)
- c.Properties.LeaseStatus = resp.Header.Get("x-ms-lease-status")
- c.Properties.LeaseState = resp.Header.Get("x-ms-lease-state")
- c.Properties.LeaseDuration = resp.Header.Get("x-ms-lease-duration")
- c.Properties.LastModified = resp.Header.Get("Last-Modified")
- c.Properties.PublicAccess = ContainerAccessType(resp.Header.Get(ContainerAccessHeader))
-
- return nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go
deleted file mode 100644
index 3696e804fe..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/copyblob.go
+++ /dev/null
@@ -1,226 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "strings"
- "time"
-)
-
-const (
- blobCopyStatusPending = "pending"
- blobCopyStatusSuccess = "success"
- blobCopyStatusAborted = "aborted"
- blobCopyStatusFailed = "failed"
-)
-
-// CopyOptions includes the options for a copy blob operation
-type CopyOptions struct {
- Timeout uint
- Source CopyOptionsConditions
- Destiny CopyOptionsConditions
- RequestID string
-}
-
-// IncrementalCopyOptions includes the options for an incremental copy blob operation
-type IncrementalCopyOptions struct {
- Timeout uint
- Destination IncrementalCopyOptionsConditions
- RequestID string
-}
-
-// CopyOptionsConditions includes some conditional options in a copy blob operation
-type CopyOptionsConditions struct {
- LeaseID string
- IfModifiedSince *time.Time
- IfUnmodifiedSince *time.Time
- IfMatch string
- IfNoneMatch string
-}
-
-// IncrementalCopyOptionsConditions includes some conditional options in a copy blob operation
-type IncrementalCopyOptionsConditions struct {
- IfModifiedSince *time.Time
- IfUnmodifiedSince *time.Time
- IfMatch string
- IfNoneMatch string
-}
-
-// Copy starts a blob copy operation and waits for the operation to
-// complete. sourceBlob parameter must be a canonical URL to the blob (can be
-// obtained using the GetURL method.) There is no SLA on blob copy and therefore
-// this helper method works faster on smaller files.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob
-func (b *Blob) Copy(sourceBlob string, options *CopyOptions) error {
- copyID, err := b.StartCopy(sourceBlob, options)
- if err != nil {
- return err
- }
-
- return b.WaitForCopy(copyID)
-}
-
-// StartCopy starts a blob copy operation.
-// sourceBlob parameter must be a canonical URL to the blob (can be
-// obtained using the GetURL method.)
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Copy-Blob
-func (b *Blob) StartCopy(sourceBlob string, options *CopyOptions) (string, error) {
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-copy-source"] = sourceBlob
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID)
- // source
- headers = addToHeaders(headers, "x-ms-source-lease-id", options.Source.LeaseID)
- headers = addTimeToHeaders(headers, "x-ms-source-if-modified-since", options.Source.IfModifiedSince)
- headers = addTimeToHeaders(headers, "x-ms-source-if-unmodified-since", options.Source.IfUnmodifiedSince)
- headers = addToHeaders(headers, "x-ms-source-if-match", options.Source.IfMatch)
- headers = addToHeaders(headers, "x-ms-source-if-none-match", options.Source.IfNoneMatch)
- //destiny
- headers = addToHeaders(headers, "x-ms-lease-id", options.Destiny.LeaseID)
- headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destiny.IfModifiedSince)
- headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destiny.IfUnmodifiedSince)
- headers = addToHeaders(headers, "x-ms-if-match", options.Destiny.IfMatch)
- headers = addToHeaders(headers, "x-ms-if-none-match", options.Destiny.IfNoneMatch)
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return "", err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{http.StatusAccepted, http.StatusCreated}); err != nil {
- return "", err
- }
-
- copyID := resp.Header.Get("x-ms-copy-id")
- if copyID == "" {
- return "", errors.New("Got empty copy id header")
- }
- return copyID, nil
-}
-
-// AbortCopyOptions includes the options for an abort blob operation
-type AbortCopyOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// AbortCopy aborts a BlobCopy which has already been triggered by the StartBlobCopy function.
-// copyID is generated from StartBlobCopy function.
-// currentLeaseID is required IF the destination blob has an active lease on it.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Abort-Copy-Blob
-func (b *Blob) AbortCopy(copyID string, options *AbortCopyOptions) error {
- params := url.Values{
- "comp": {"copy"},
- "copyid": {copyID},
- }
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-copy-action"] = "abort"
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// WaitForCopy loops until a BlobCopy operation is completed (or fails with error)
-func (b *Blob) WaitForCopy(copyID string) error {
- for {
- err := b.GetProperties(nil)
- if err != nil {
- return err
- }
-
- if b.Properties.CopyID != copyID {
- return errBlobCopyIDMismatch
- }
-
- switch b.Properties.CopyStatus {
- case blobCopyStatusSuccess:
- return nil
- case blobCopyStatusPending:
- continue
- case blobCopyStatusAborted:
- return errBlobCopyAborted
- case blobCopyStatusFailed:
- return fmt.Errorf("storage: blob copy failed. Id=%s Description=%s", b.Properties.CopyID, b.Properties.CopyStatusDescription)
- default:
- return fmt.Errorf("storage: unhandled blob copy status: '%s'", b.Properties.CopyStatus)
- }
- }
-}
-
-// IncrementalCopyBlob copies a snapshot of a source blob and copies to referring blob
-// sourceBlob parameter must be a valid snapshot URL of the original blob.
-// THe original blob mut be public, or use a Shared Access Signature.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/incremental-copy-blob .
-func (b *Blob) IncrementalCopyBlob(sourceBlobURL string, snapshotTime time.Time, options *IncrementalCopyOptions) (string, error) {
- params := url.Values{"comp": {"incrementalcopy"}}
-
- // need formatting to 7 decimal places so it's friendly to Windows and *nix
- snapshotTimeFormatted := snapshotTime.Format("2006-01-02T15:04:05.0000000Z")
- u, err := url.Parse(sourceBlobURL)
- if err != nil {
- return "", err
- }
- query := u.Query()
- query.Add("snapshot", snapshotTimeFormatted)
- encodedQuery := query.Encode()
- encodedQuery = strings.Replace(encodedQuery, "%3A", ":", -1)
- u.RawQuery = encodedQuery
- snapshotURL := u.String()
-
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-copy-source"] = snapshotURL
-
- if options != nil {
- addTimeout(params, options.Timeout)
- headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID)
- headers = addTimeToHeaders(headers, "x-ms-if-modified-since", options.Destination.IfModifiedSince)
- headers = addTimeToHeaders(headers, "x-ms-if-unmodified-since", options.Destination.IfUnmodifiedSince)
- headers = addToHeaders(headers, "x-ms-if-match", options.Destination.IfMatch)
- headers = addToHeaders(headers, "x-ms-if-none-match", options.Destination.IfNoneMatch)
- }
-
- // get URI of destination blob
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return "", err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{http.StatusAccepted}); err != nil {
- return "", err
- }
-
- copyID := resp.Header.Get("x-ms-copy-id")
- if copyID == "" {
- return "", errors.New("Got empty copy id header")
- }
- return copyID, nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go
deleted file mode 100644
index 498e9837c5..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/directory.go
+++ /dev/null
@@ -1,227 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "net/http"
- "net/url"
- "sync"
-)
-
-// Directory represents a directory on a share.
-type Directory struct {
- fsc *FileServiceClient
- Metadata map[string]string
- Name string `xml:"Name"`
- parent *Directory
- Properties DirectoryProperties
- share *Share
-}
-
-// DirectoryProperties contains various properties of a directory.
-type DirectoryProperties struct {
- LastModified string `xml:"Last-Modified"`
- Etag string `xml:"Etag"`
-}
-
-// ListDirsAndFilesParameters defines the set of customizable parameters to
-// make a List Files and Directories call.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files
-type ListDirsAndFilesParameters struct {
- Prefix string
- Marker string
- MaxResults uint
- Timeout uint
-}
-
-// DirsAndFilesListResponse contains the response fields from
-// a List Files and Directories call.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files
-type DirsAndFilesListResponse struct {
- XMLName xml.Name `xml:"EnumerationResults"`
- Xmlns string `xml:"xmlns,attr"`
- Marker string `xml:"Marker"`
- MaxResults int64 `xml:"MaxResults"`
- Directories []Directory `xml:"Entries>Directory"`
- Files []File `xml:"Entries>File"`
- NextMarker string `xml:"NextMarker"`
-}
-
-// builds the complete directory path for this directory object.
-func (d *Directory) buildPath() string {
- path := ""
- current := d
- for current.Name != "" {
- path = "/" + current.Name + path
- current = current.parent
- }
- return d.share.buildPath() + path
-}
-
-// Create this directory in the associated share.
-// If a directory with the same name already exists, the operation fails.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory
-func (d *Directory) Create(options *FileRequestOptions) error {
- // if this is the root directory exit early
- if d.parent == nil {
- return nil
- }
-
- params := prepareOptions(options)
- headers, err := d.fsc.createResource(d.buildPath(), resourceDirectory, params, mergeMDIntoExtraHeaders(d.Metadata, nil), []int{http.StatusCreated})
- if err != nil {
- return err
- }
-
- d.updateEtagAndLastModified(headers)
- return nil
-}
-
-// CreateIfNotExists creates this directory under the associated share if the
-// directory does not exist. Returns true if the directory is newly created or
-// false if the directory already exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Directory
-func (d *Directory) CreateIfNotExists(options *FileRequestOptions) (bool, error) {
- // if this is the root directory exit early
- if d.parent == nil {
- return false, nil
- }
-
- params := prepareOptions(options)
- resp, err := d.fsc.createResourceNoClose(d.buildPath(), resourceDirectory, params, nil)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict {
- if resp.StatusCode == http.StatusCreated {
- d.updateEtagAndLastModified(resp.Header)
- return true, nil
- }
-
- return false, d.FetchAttributes(nil)
- }
- }
-
- return false, err
-}
-
-// Delete removes this directory. It must be empty in order to be deleted.
-// If the directory does not exist the operation fails.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory
-func (d *Directory) Delete(options *FileRequestOptions) error {
- return d.fsc.deleteResource(d.buildPath(), resourceDirectory, options)
-}
-
-// DeleteIfExists removes this directory if it exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Directory
-func (d *Directory) DeleteIfExists(options *FileRequestOptions) (bool, error) {
- resp, err := d.fsc.deleteResourceNoClose(d.buildPath(), resourceDirectory, options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusAccepted, nil
- }
- }
- return false, err
-}
-
-// Exists returns true if this directory exists.
-func (d *Directory) Exists() (bool, error) {
- exists, headers, err := d.fsc.resourceExists(d.buildPath(), resourceDirectory)
- if exists {
- d.updateEtagAndLastModified(headers)
- }
- return exists, err
-}
-
-// FetchAttributes retrieves metadata for this directory.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-directory-properties
-func (d *Directory) FetchAttributes(options *FileRequestOptions) error {
- params := prepareOptions(options)
- headers, err := d.fsc.getResourceHeaders(d.buildPath(), compNone, resourceDirectory, params, http.MethodHead)
- if err != nil {
- return err
- }
-
- d.updateEtagAndLastModified(headers)
- d.Metadata = getMetadataFromHeaders(headers)
-
- return nil
-}
-
-// GetDirectoryReference returns a child Directory object for this directory.
-func (d *Directory) GetDirectoryReference(name string) *Directory {
- return &Directory{
- fsc: d.fsc,
- Name: name,
- parent: d,
- share: d.share,
- }
-}
-
-// GetFileReference returns a child File object for this directory.
-func (d *Directory) GetFileReference(name string) *File {
- return &File{
- fsc: d.fsc,
- Name: name,
- parent: d,
- share: d.share,
- mutex: &sync.Mutex{},
- }
-}
-
-// ListDirsAndFiles returns a list of files and directories under this directory.
-// It also contains a pagination token and other response details.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Directories-and-Files
-func (d *Directory) ListDirsAndFiles(params ListDirsAndFilesParameters) (*DirsAndFilesListResponse, error) {
- q := mergeParams(params.getParameters(), getURLInitValues(compList, resourceDirectory))
-
- resp, err := d.fsc.listContent(d.buildPath(), q, nil)
- if err != nil {
- return nil, err
- }
-
- defer resp.Body.Close()
- var out DirsAndFilesListResponse
- err = xmlUnmarshal(resp.Body, &out)
- return &out, err
-}
-
-// SetMetadata replaces the metadata for this directory.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetDirectoryMetadata. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Directory-Metadata
-func (d *Directory) SetMetadata(options *FileRequestOptions) error {
- headers, err := d.fsc.setResourceHeaders(d.buildPath(), compMetadata, resourceDirectory, mergeMDIntoExtraHeaders(d.Metadata, nil), options)
- if err != nil {
- return err
- }
-
- d.updateEtagAndLastModified(headers)
- return nil
-}
-
-// updates Etag and last modified date
-func (d *Directory) updateEtagAndLastModified(headers http.Header) {
- d.Properties.Etag = headers.Get("Etag")
- d.Properties.LastModified = headers.Get("Last-Modified")
-}
-
-// URL gets the canonical URL to this directory.
-// This method does not create a publicly accessible URL if the directory
-// is private and this method does not check if the directory exists.
-func (d *Directory) URL() string {
- return d.fsc.client.getEndpoint(fileServiceName, d.buildPath(), url.Values{})
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go
deleted file mode 100644
index 9ef63c8dd9..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/entity.go
+++ /dev/null
@@ -1,455 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "encoding/base64"
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-
- "github.com/gofrs/uuid"
-)
-
-// Annotating as secure for gas scanning
-/* #nosec */
-const (
- partitionKeyNode = "PartitionKey"
- rowKeyNode = "RowKey"
- etagErrorTemplate = "Etag didn't match: %v"
-)
-
-var (
- errEmptyPayload = errors.New("Empty payload is not a valid metadata level for this operation")
- errNilPreviousResult = errors.New("The previous results page is nil")
- errNilNextLink = errors.New("There are no more pages in this query results")
-)
-
-// Entity represents an entity inside an Azure table.
-type Entity struct {
- Table *Table
- PartitionKey string
- RowKey string
- TimeStamp time.Time
- OdataMetadata string
- OdataType string
- OdataID string
- OdataEtag string
- OdataEditLink string
- Properties map[string]interface{}
-}
-
-// GetEntityReference returns an Entity object with the specified
-// partition key and row key.
-func (t *Table) GetEntityReference(partitionKey, rowKey string) *Entity {
- return &Entity{
- PartitionKey: partitionKey,
- RowKey: rowKey,
- Table: t,
- }
-}
-
-// EntityOptions includes options for entity operations.
-type EntityOptions struct {
- Timeout uint
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetEntityOptions includes options for a get entity operation
-type GetEntityOptions struct {
- Select []string
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Get gets the referenced entity. Which properties to get can be
-// specified using the select option.
-// See:
-// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities
-// https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities
-func (e *Entity) Get(timeout uint, ml MetadataLevel, options *GetEntityOptions) error {
- if ml == EmptyPayload {
- return errEmptyPayload
- }
- // RowKey and PartitionKey could be lost if not included in the query
- // As those are the entity identifiers, it is best if they are not lost
- rk := e.RowKey
- pk := e.PartitionKey
-
- query := url.Values{
- "timeout": {strconv.FormatUint(uint64(timeout), 10)},
- }
- headers := e.Table.tsc.client.getStandardHeaders()
- headers[headerAccept] = string(ml)
-
- if options != nil {
- if len(options.Select) > 0 {
- query.Add("$select", strings.Join(options.Select, ","))
- }
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
-
- uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
- resp, err := e.Table.tsc.client.exec(http.MethodGet, uri, headers, nil, e.Table.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- respBody, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- err = json.Unmarshal(respBody, e)
- if err != nil {
- return err
- }
- e.PartitionKey = pk
- e.RowKey = rk
-
- return nil
-}
-
-// Insert inserts the referenced entity in its table.
-// The function fails if there is an entity with the same
-// PartitionKey and RowKey in the table.
-// ml determines the level of detail of metadata in the operation response,
-// or no data at all.
-// See: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-entity
-func (e *Entity) Insert(ml MetadataLevel, options *EntityOptions) error {
- query, headers := options.getParameters()
- headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders())
-
- body, err := json.Marshal(e)
- if err != nil {
- return err
- }
- headers = addBodyRelatedHeaders(headers, len(body))
- headers = addReturnContentHeaders(headers, ml)
-
- uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.Table.buildPath(), query)
- resp, err := e.Table.tsc.client.exec(http.MethodPost, uri, headers, bytes.NewReader(body), e.Table.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if ml != EmptyPayload {
- if err = checkRespCode(resp, []int{http.StatusCreated}); err != nil {
- return err
- }
- data, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- if err = e.UnmarshalJSON(data); err != nil {
- return err
- }
- } else {
- if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Update updates the contents of an entity. The function fails if there is no entity
-// with the same PartitionKey and RowKey in the table or if the ETag is different
-// than the one in Azure.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/update-entity2
-func (e *Entity) Update(force bool, options *EntityOptions) error {
- return e.updateMerge(force, http.MethodPut, options)
-}
-
-// Merge merges the contents of entity specified with PartitionKey and RowKey
-// with the content specified in Properties.
-// The function fails if there is no entity with the same PartitionKey and
-// RowKey in the table or if the ETag is different than the one in Azure.
-// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/merge-entity
-func (e *Entity) Merge(force bool, options *EntityOptions) error {
- return e.updateMerge(force, "MERGE", options)
-}
-
-// Delete deletes the entity.
-// The function fails if there is no entity with the same PartitionKey and
-// RowKey in the table or if the ETag is different than the one in Azure.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/delete-entity1
-func (e *Entity) Delete(force bool, options *EntityOptions) error {
- query, headers := options.getParameters()
- headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders())
-
- headers = addIfMatchHeader(headers, force, e.OdataEtag)
- headers = addReturnContentHeaders(headers, EmptyPayload)
-
- uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
- resp, err := e.Table.tsc.client.exec(http.MethodDelete, uri, headers, nil, e.Table.tsc.auth)
- if err != nil {
- if resp != nil && resp.StatusCode == http.StatusPreconditionFailed {
- return fmt.Errorf(etagErrorTemplate, err)
- }
- return err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
- return err
- }
-
- return e.updateTimestamp(resp.Header)
-}
-
-// InsertOrReplace inserts an entity or replaces the existing one.
-// Read more: https://docs.microsoft.com/rest/api/storageservices/fileservices/insert-or-replace-entity
-func (e *Entity) InsertOrReplace(options *EntityOptions) error {
- return e.insertOr(http.MethodPut, options)
-}
-
-// InsertOrMerge inserts an entity or merges the existing one.
-// Read more: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/insert-or-merge-entity
-func (e *Entity) InsertOrMerge(options *EntityOptions) error {
- return e.insertOr("MERGE", options)
-}
-
-func (e *Entity) buildPath() string {
- return fmt.Sprintf("%s(PartitionKey='%s',RowKey='%s')", e.Table.buildPath(), e.PartitionKey, e.RowKey)
-}
-
-// MarshalJSON is a custom marshaller for entity
-func (e *Entity) MarshalJSON() ([]byte, error) {
- completeMap := map[string]interface{}{}
- completeMap[partitionKeyNode] = e.PartitionKey
- completeMap[rowKeyNode] = e.RowKey
- for k, v := range e.Properties {
- typeKey := strings.Join([]string{k, OdataTypeSuffix}, "")
- switch t := v.(type) {
- case []byte:
- completeMap[typeKey] = OdataBinary
- completeMap[k] = t
- case time.Time:
- completeMap[typeKey] = OdataDateTime
- completeMap[k] = t.Format(time.RFC3339Nano)
- case uuid.UUID:
- completeMap[typeKey] = OdataGUID
- completeMap[k] = t.String()
- case int64:
- completeMap[typeKey] = OdataInt64
- completeMap[k] = fmt.Sprintf("%v", v)
- case float32, float64:
- completeMap[typeKey] = OdataDouble
- completeMap[k] = fmt.Sprintf("%v", v)
- default:
- completeMap[k] = v
- }
- if strings.HasSuffix(k, OdataTypeSuffix) {
- if !(completeMap[k] == OdataBinary ||
- completeMap[k] == OdataDateTime ||
- completeMap[k] == OdataGUID ||
- completeMap[k] == OdataInt64 ||
- completeMap[k] == OdataDouble) {
- return nil, fmt.Errorf("Odata.type annotation %v value is not valid", k)
- }
- valueKey := strings.TrimSuffix(k, OdataTypeSuffix)
- if _, ok := completeMap[valueKey]; !ok {
- return nil, fmt.Errorf("Odata.type annotation %v defined without value defined", k)
- }
- }
- }
- return json.Marshal(completeMap)
-}
-
-// UnmarshalJSON is a custom unmarshaller for entities
-func (e *Entity) UnmarshalJSON(data []byte) error {
- errorTemplate := "Deserializing error: %v"
-
- props := map[string]interface{}{}
- err := json.Unmarshal(data, &props)
- if err != nil {
- return err
- }
-
- // deselialize metadata
- e.OdataMetadata = stringFromMap(props, "odata.metadata")
- e.OdataType = stringFromMap(props, "odata.type")
- e.OdataID = stringFromMap(props, "odata.id")
- e.OdataEtag = stringFromMap(props, "odata.etag")
- e.OdataEditLink = stringFromMap(props, "odata.editLink")
- e.PartitionKey = stringFromMap(props, partitionKeyNode)
- e.RowKey = stringFromMap(props, rowKeyNode)
-
- // deserialize timestamp
- timeStamp, ok := props["Timestamp"]
- if ok {
- str, ok := timeStamp.(string)
- if !ok {
- return fmt.Errorf(errorTemplate, "Timestamp casting error")
- }
- t, err := time.Parse(time.RFC3339Nano, str)
- if err != nil {
- return fmt.Errorf(errorTemplate, err)
- }
- e.TimeStamp = t
- }
- delete(props, "Timestamp")
- delete(props, "Timestamp@odata.type")
-
- // deserialize entity (user defined fields)
- for k, v := range props {
- if strings.HasSuffix(k, OdataTypeSuffix) {
- valueKey := strings.TrimSuffix(k, OdataTypeSuffix)
- str, ok := props[valueKey].(string)
- if !ok {
- return fmt.Errorf(errorTemplate, fmt.Sprintf("%v casting error", v))
- }
- switch v {
- case OdataBinary:
- props[valueKey], err = base64.StdEncoding.DecodeString(str)
- if err != nil {
- return fmt.Errorf(errorTemplate, err)
- }
- case OdataDateTime:
- t, err := time.Parse("2006-01-02T15:04:05Z", str)
- if err != nil {
- return fmt.Errorf(errorTemplate, err)
- }
- props[valueKey] = t
- case OdataGUID:
- props[valueKey] = uuid.FromStringOrNil(str)
- case OdataInt64:
- i, err := strconv.ParseInt(str, 10, 64)
- if err != nil {
- return fmt.Errorf(errorTemplate, err)
- }
- props[valueKey] = i
- case OdataDouble:
- f, err := strconv.ParseFloat(str, 64)
- if err != nil {
- return fmt.Errorf(errorTemplate, err)
- }
- props[valueKey] = f
- default:
- return fmt.Errorf(errorTemplate, fmt.Sprintf("%v is not supported", v))
- }
- delete(props, k)
- }
- }
-
- e.Properties = props
- return nil
-}
-
-func getAndDelete(props map[string]interface{}, key string) interface{} {
- if value, ok := props[key]; ok {
- delete(props, key)
- return value
- }
- return nil
-}
-
-func addIfMatchHeader(h map[string]string, force bool, etag string) map[string]string {
- if force {
- h[headerIfMatch] = "*"
- } else {
- h[headerIfMatch] = etag
- }
- return h
-}
-
-// updates Etag and timestamp
-func (e *Entity) updateEtagAndTimestamp(headers http.Header) error {
- e.OdataEtag = headers.Get(headerEtag)
- return e.updateTimestamp(headers)
-}
-
-func (e *Entity) updateTimestamp(headers http.Header) error {
- str := headers.Get(headerDate)
- t, err := time.Parse(time.RFC1123, str)
- if err != nil {
- return fmt.Errorf("Update timestamp error: %v", err)
- }
- e.TimeStamp = t
- return nil
-}
-
-func (e *Entity) insertOr(verb string, options *EntityOptions) error {
- query, headers := options.getParameters()
- headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders())
-
- body, err := json.Marshal(e)
- if err != nil {
- return err
- }
- headers = addBodyRelatedHeaders(headers, len(body))
- headers = addReturnContentHeaders(headers, EmptyPayload)
-
- uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
- resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
- return err
- }
-
- return e.updateEtagAndTimestamp(resp.Header)
-}
-
-func (e *Entity) updateMerge(force bool, verb string, options *EntityOptions) error {
- query, headers := options.getParameters()
- headers = mergeHeaders(headers, e.Table.tsc.client.getStandardHeaders())
-
- body, err := json.Marshal(e)
- if err != nil {
- return err
- }
- headers = addBodyRelatedHeaders(headers, len(body))
- headers = addIfMatchHeader(headers, force, e.OdataEtag)
- headers = addReturnContentHeaders(headers, EmptyPayload)
-
- uri := e.Table.tsc.client.getEndpoint(tableServiceName, e.buildPath(), query)
- resp, err := e.Table.tsc.client.exec(verb, uri, headers, bytes.NewReader(body), e.Table.tsc.auth)
- if err != nil {
- if resp != nil && resp.StatusCode == http.StatusPreconditionFailed {
- return fmt.Errorf(etagErrorTemplate, err)
- }
- return err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
- return err
- }
-
- return e.updateEtagAndTimestamp(resp.Header)
-}
-
-func stringFromMap(props map[string]interface{}, key string) string {
- value := getAndDelete(props, key)
- if value != nil {
- return value.(string)
- }
- return ""
-}
-
-func (options *EntityOptions) getParameters() (url.Values, map[string]string) {
- query := url.Values{}
- headers := map[string]string{}
- if options != nil {
- query = addTimeout(query, options.Timeout)
- headers = headersFromStruct(*options)
- }
- return query, headers
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go
deleted file mode 100644
index 9848025ccb..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/file.go
+++ /dev/null
@@ -1,473 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
- "sync"
-)
-
-const fourMB = uint64(4194304)
-const oneTB = uint64(1099511627776)
-
-// Export maximum range and file sizes
-
-// MaxRangeSize defines the maximum size in bytes for a file range.
-const MaxRangeSize = fourMB
-
-// MaxFileSize defines the maximum size in bytes for a file.
-const MaxFileSize = oneTB
-
-// File represents a file on a share.
-type File struct {
- fsc *FileServiceClient
- Metadata map[string]string
- Name string `xml:"Name"`
- parent *Directory
- Properties FileProperties `xml:"Properties"`
- share *Share
- FileCopyProperties FileCopyState
- mutex *sync.Mutex
-}
-
-// FileProperties contains various properties of a file.
-type FileProperties struct {
- CacheControl string `header:"x-ms-cache-control"`
- Disposition string `header:"x-ms-content-disposition"`
- Encoding string `header:"x-ms-content-encoding"`
- Etag string
- Language string `header:"x-ms-content-language"`
- LastModified string
- Length uint64 `xml:"Content-Length" header:"x-ms-content-length"`
- MD5 string `header:"x-ms-content-md5"`
- Type string `header:"x-ms-content-type"`
-}
-
-// FileCopyState contains various properties of a file copy operation.
-type FileCopyState struct {
- CompletionTime string
- ID string `header:"x-ms-copy-id"`
- Progress string
- Source string
- Status string `header:"x-ms-copy-status"`
- StatusDesc string
-}
-
-// FileStream contains file data returned from a call to GetFile.
-type FileStream struct {
- Body io.ReadCloser
- ContentMD5 string
-}
-
-// FileRequestOptions will be passed to misc file operations.
-// Currently just Timeout (in seconds) but could expand.
-type FileRequestOptions struct {
- Timeout uint // timeout duration in seconds.
-}
-
-func prepareOptions(options *FileRequestOptions) url.Values {
- params := url.Values{}
- if options != nil {
- params = addTimeout(params, options.Timeout)
- }
- return params
-}
-
-// FileRanges contains a list of file range information for a file.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges
-type FileRanges struct {
- ContentLength uint64
- LastModified string
- ETag string
- FileRanges []FileRange `xml:"Range"`
-}
-
-// FileRange contains range information for a file.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges
-type FileRange struct {
- Start uint64 `xml:"Start"`
- End uint64 `xml:"End"`
-}
-
-func (fr FileRange) String() string {
- return fmt.Sprintf("bytes=%d-%d", fr.Start, fr.End)
-}
-
-// builds the complete file path for this file object
-func (f *File) buildPath() string {
- return f.parent.buildPath() + "/" + f.Name
-}
-
-// ClearRange releases the specified range of space in a file.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range
-func (f *File) ClearRange(fileRange FileRange, options *FileRequestOptions) error {
- var timeout *uint
- if options != nil {
- timeout = &options.Timeout
- }
- headers, err := f.modifyRange(nil, fileRange, timeout, nil)
- if err != nil {
- return err
- }
-
- f.updateEtagAndLastModified(headers)
- return nil
-}
-
-// Create creates a new file or replaces an existing one.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-File
-func (f *File) Create(maxSize uint64, options *FileRequestOptions) error {
- if maxSize > oneTB {
- return fmt.Errorf("max file size is 1TB")
- }
- params := prepareOptions(options)
- headers := headersFromStruct(f.Properties)
- headers["x-ms-content-length"] = strconv.FormatUint(maxSize, 10)
- headers["x-ms-type"] = "file"
-
- outputHeaders, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, headers), []int{http.StatusCreated})
- if err != nil {
- return err
- }
-
- f.Properties.Length = maxSize
- f.updateEtagAndLastModified(outputHeaders)
- return nil
-}
-
-// CopyFile operation copied a file/blob from the sourceURL to the path provided.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/copy-file
-func (f *File) CopyFile(sourceURL string, options *FileRequestOptions) error {
- extraHeaders := map[string]string{
- "x-ms-type": "file",
- "x-ms-copy-source": sourceURL,
- }
- params := prepareOptions(options)
-
- headers, err := f.fsc.createResource(f.buildPath(), resourceFile, params, mergeMDIntoExtraHeaders(f.Metadata, extraHeaders), []int{http.StatusAccepted})
- if err != nil {
- return err
- }
-
- f.updateEtagAndLastModified(headers)
- f.FileCopyProperties.ID = headers.Get("X-Ms-Copy-Id")
- f.FileCopyProperties.Status = headers.Get("X-Ms-Copy-Status")
- return nil
-}
-
-// Delete immediately removes this file from the storage account.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2
-func (f *File) Delete(options *FileRequestOptions) error {
- return f.fsc.deleteResource(f.buildPath(), resourceFile, options)
-}
-
-// DeleteIfExists removes this file if it exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-File2
-func (f *File) DeleteIfExists(options *FileRequestOptions) (bool, error) {
- resp, err := f.fsc.deleteResourceNoClose(f.buildPath(), resourceFile, options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusAccepted, nil
- }
- }
- return false, err
-}
-
-// GetFileOptions includes options for a get file operation
-type GetFileOptions struct {
- Timeout uint
- GetContentMD5 bool
-}
-
-// DownloadToStream operation downloads the file.
-//
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file
-func (f *File) DownloadToStream(options *FileRequestOptions) (io.ReadCloser, error) {
- params := prepareOptions(options)
- resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, nil)
- if err != nil {
- return nil, err
- }
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- drainRespBody(resp)
- return nil, err
- }
- return resp.Body, nil
-}
-
-// DownloadRangeToStream operation downloads the specified range of this file with optional MD5 hash.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file
-func (f *File) DownloadRangeToStream(fileRange FileRange, options *GetFileOptions) (fs FileStream, err error) {
- extraHeaders := map[string]string{
- "Range": fileRange.String(),
- }
- params := url.Values{}
- if options != nil {
- if options.GetContentMD5 {
- if isRangeTooBig(fileRange) {
- return fs, fmt.Errorf("must specify a range less than or equal to 4MB when getContentMD5 is true")
- }
- extraHeaders["x-ms-range-get-content-md5"] = "true"
- }
- params = addTimeout(params, options.Timeout)
- }
-
- resp, err := f.fsc.getResourceNoClose(f.buildPath(), compNone, resourceFile, params, http.MethodGet, extraHeaders)
- if err != nil {
- return fs, err
- }
-
- if err = checkRespCode(resp, []int{http.StatusOK, http.StatusPartialContent}); err != nil {
- drainRespBody(resp)
- return fs, err
- }
-
- fs.Body = resp.Body
- if options != nil && options.GetContentMD5 {
- fs.ContentMD5 = resp.Header.Get("Content-MD5")
- }
- return fs, nil
-}
-
-// Exists returns true if this file exists.
-func (f *File) Exists() (bool, error) {
- exists, headers, err := f.fsc.resourceExists(f.buildPath(), resourceFile)
- if exists {
- f.updateEtagAndLastModified(headers)
- f.updateProperties(headers)
- }
- return exists, err
-}
-
-// FetchAttributes updates metadata and properties for this file.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-properties
-func (f *File) FetchAttributes(options *FileRequestOptions) error {
- params := prepareOptions(options)
- headers, err := f.fsc.getResourceHeaders(f.buildPath(), compNone, resourceFile, params, http.MethodHead)
- if err != nil {
- return err
- }
-
- f.updateEtagAndLastModified(headers)
- f.updateProperties(headers)
- f.Metadata = getMetadataFromHeaders(headers)
- return nil
-}
-
-// returns true if the range is larger than 4MB
-func isRangeTooBig(fileRange FileRange) bool {
- if fileRange.End-fileRange.Start > fourMB {
- return true
- }
-
- return false
-}
-
-// ListRangesOptions includes options for a list file ranges operation
-type ListRangesOptions struct {
- Timeout uint
- ListRange *FileRange
-}
-
-// ListRanges returns the list of valid ranges for this file.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Ranges
-func (f *File) ListRanges(options *ListRangesOptions) (*FileRanges, error) {
- params := url.Values{"comp": {"rangelist"}}
-
- // add optional range to list
- var headers map[string]string
- if options != nil {
- params = addTimeout(params, options.Timeout)
- if options.ListRange != nil {
- headers = make(map[string]string)
- headers["Range"] = options.ListRange.String()
- }
- }
-
- resp, err := f.fsc.listContent(f.buildPath(), params, headers)
- if err != nil {
- return nil, err
- }
-
- defer resp.Body.Close()
- var cl uint64
- cl, err = strconv.ParseUint(resp.Header.Get("x-ms-content-length"), 10, 64)
- if err != nil {
- ioutil.ReadAll(resp.Body)
- return nil, err
- }
-
- var out FileRanges
- out.ContentLength = cl
- out.ETag = resp.Header.Get("ETag")
- out.LastModified = resp.Header.Get("Last-Modified")
-
- err = xmlUnmarshal(resp.Body, &out)
- return &out, err
-}
-
-// modifies a range of bytes in this file
-func (f *File) modifyRange(bytes io.Reader, fileRange FileRange, timeout *uint, contentMD5 *string) (http.Header, error) {
- if err := f.fsc.checkForStorageEmulator(); err != nil {
- return nil, err
- }
- if fileRange.End < fileRange.Start {
- return nil, errors.New("the value for rangeEnd must be greater than or equal to rangeStart")
- }
- if bytes != nil && isRangeTooBig(fileRange) {
- return nil, errors.New("range cannot exceed 4MB in size")
- }
-
- params := url.Values{"comp": {"range"}}
- if timeout != nil {
- params = addTimeout(params, *timeout)
- }
-
- uri := f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), params)
-
- // default to clear
- write := "clear"
- cl := uint64(0)
-
- // if bytes is not nil then this is an update operation
- if bytes != nil {
- write = "update"
- cl = (fileRange.End - fileRange.Start) + 1
- }
-
- extraHeaders := map[string]string{
- "Content-Length": strconv.FormatUint(cl, 10),
- "Range": fileRange.String(),
- "x-ms-write": write,
- }
-
- if contentMD5 != nil {
- extraHeaders["Content-MD5"] = *contentMD5
- }
-
- headers := mergeHeaders(f.fsc.client.getStandardHeaders(), extraHeaders)
- resp, err := f.fsc.client.exec(http.MethodPut, uri, headers, bytes, f.fsc.auth)
- if err != nil {
- return nil, err
- }
- defer drainRespBody(resp)
- return resp.Header, checkRespCode(resp, []int{http.StatusCreated})
-}
-
-// SetMetadata replaces the metadata for this file.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetFileMetadata. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Metadata
-func (f *File) SetMetadata(options *FileRequestOptions) error {
- headers, err := f.fsc.setResourceHeaders(f.buildPath(), compMetadata, resourceFile, mergeMDIntoExtraHeaders(f.Metadata, nil), options)
- if err != nil {
- return err
- }
-
- f.updateEtagAndLastModified(headers)
- return nil
-}
-
-// SetProperties sets system properties on this file.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by SetFileProperties. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-File-Properties
-func (f *File) SetProperties(options *FileRequestOptions) error {
- headers, err := f.fsc.setResourceHeaders(f.buildPath(), compProperties, resourceFile, headersFromStruct(f.Properties), options)
- if err != nil {
- return err
- }
-
- f.updateEtagAndLastModified(headers)
- return nil
-}
-
-// updates Etag and last modified date
-func (f *File) updateEtagAndLastModified(headers http.Header) {
- f.Properties.Etag = headers.Get("Etag")
- f.Properties.LastModified = headers.Get("Last-Modified")
-}
-
-// updates file properties from the specified HTTP header
-func (f *File) updateProperties(header http.Header) {
- size, err := strconv.ParseUint(header.Get("Content-Length"), 10, 64)
- if err == nil {
- f.Properties.Length = size
- }
-
- f.updateEtagAndLastModified(header)
- f.Properties.CacheControl = header.Get("Cache-Control")
- f.Properties.Disposition = header.Get("Content-Disposition")
- f.Properties.Encoding = header.Get("Content-Encoding")
- f.Properties.Language = header.Get("Content-Language")
- f.Properties.MD5 = header.Get("Content-MD5")
- f.Properties.Type = header.Get("Content-Type")
-}
-
-// URL gets the canonical URL to this file.
-// This method does not create a publicly accessible URL if the file
-// is private and this method does not check if the file exists.
-func (f *File) URL() string {
- return f.fsc.client.getEndpoint(fileServiceName, f.buildPath(), nil)
-}
-
-// WriteRangeOptions includes options for a write file range operation
-type WriteRangeOptions struct {
- Timeout uint
- ContentMD5 string
-}
-
-// WriteRange writes a range of bytes to this file with an optional MD5 hash of the content (inside
-// options parameter). Note that the length of bytes must match (rangeEnd - rangeStart) + 1 with
-// a maximum size of 4MB.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Range
-func (f *File) WriteRange(bytes io.Reader, fileRange FileRange, options *WriteRangeOptions) error {
- if bytes == nil {
- return errors.New("bytes cannot be nil")
- }
- var timeout *uint
- var md5 *string
- if options != nil {
- timeout = &options.Timeout
- md5 = &options.ContentMD5
- }
-
- headers, err := f.modifyRange(bytes, fileRange, timeout, md5)
- if err != nil {
- return err
- }
- // it's perfectly legal for multiple go routines to call WriteRange
- // on the same *File (e.g. concurrently writing non-overlapping ranges)
- // so we must take the file mutex before updating our properties.
- f.mutex.Lock()
- f.updateEtagAndLastModified(headers)
- f.mutex.Unlock()
- return nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go
deleted file mode 100644
index 6a12d6dcba..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/fileserviceclient.go
+++ /dev/null
@@ -1,327 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "fmt"
- "net/http"
- "net/url"
- "strconv"
-)
-
-// FileServiceClient contains operations for Microsoft Azure File Service.
-type FileServiceClient struct {
- client Client
- auth authentication
-}
-
-// ListSharesParameters defines the set of customizable parameters to make a
-// List Shares call.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares
-type ListSharesParameters struct {
- Prefix string
- Marker string
- Include string
- MaxResults uint
- Timeout uint
-}
-
-// ShareListResponse contains the response fields from
-// ListShares call.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/List-Shares
-type ShareListResponse struct {
- XMLName xml.Name `xml:"EnumerationResults"`
- Xmlns string `xml:"xmlns,attr"`
- Prefix string `xml:"Prefix"`
- Marker string `xml:"Marker"`
- NextMarker string `xml:"NextMarker"`
- MaxResults int64 `xml:"MaxResults"`
- Shares []Share `xml:"Shares>Share"`
-}
-
-type compType string
-
-const (
- compNone compType = ""
- compList compType = "list"
- compMetadata compType = "metadata"
- compProperties compType = "properties"
- compRangeList compType = "rangelist"
-)
-
-func (ct compType) String() string {
- return string(ct)
-}
-
-type resourceType string
-
-const (
- resourceDirectory resourceType = "directory"
- resourceFile resourceType = ""
- resourceShare resourceType = "share"
-)
-
-func (rt resourceType) String() string {
- return string(rt)
-}
-
-func (p ListSharesParameters) getParameters() url.Values {
- out := url.Values{}
-
- if p.Prefix != "" {
- out.Set("prefix", p.Prefix)
- }
- if p.Marker != "" {
- out.Set("marker", p.Marker)
- }
- if p.Include != "" {
- out.Set("include", p.Include)
- }
- if p.MaxResults != 0 {
- out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10))
- }
- if p.Timeout != 0 {
- out.Set("timeout", strconv.FormatUint(uint64(p.Timeout), 10))
- }
-
- return out
-}
-
-func (p ListDirsAndFilesParameters) getParameters() url.Values {
- out := url.Values{}
-
- if p.Prefix != "" {
- out.Set("prefix", p.Prefix)
- }
- if p.Marker != "" {
- out.Set("marker", p.Marker)
- }
- if p.MaxResults != 0 {
- out.Set("maxresults", strconv.FormatUint(uint64(p.MaxResults), 10))
- }
- out = addTimeout(out, p.Timeout)
-
- return out
-}
-
-// returns url.Values for the specified types
-func getURLInitValues(comp compType, res resourceType) url.Values {
- values := url.Values{}
- if comp != compNone {
- values.Set("comp", comp.String())
- }
- if res != resourceFile {
- values.Set("restype", res.String())
- }
- return values
-}
-
-// GetShareReference returns a Share object for the specified share name.
-func (f *FileServiceClient) GetShareReference(name string) *Share {
- return &Share{
- fsc: f,
- Name: name,
- Properties: ShareProperties{
- Quota: -1,
- },
- }
-}
-
-// ListShares returns the list of shares in a storage account along with
-// pagination token and other response details.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/list-shares
-func (f FileServiceClient) ListShares(params ListSharesParameters) (*ShareListResponse, error) {
- q := mergeParams(params.getParameters(), url.Values{"comp": {"list"}})
-
- var out ShareListResponse
- resp, err := f.listContent("", q, nil)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- err = xmlUnmarshal(resp.Body, &out)
-
- // assign our client to the newly created Share objects
- for i := range out.Shares {
- out.Shares[i].fsc = &f
- }
- return &out, err
-}
-
-// GetServiceProperties gets the properties of your storage account's file service.
-// File service does not support logging
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-file-service-properties
-func (f *FileServiceClient) GetServiceProperties() (*ServiceProperties, error) {
- return f.client.getServiceProperties(fileServiceName, f.auth)
-}
-
-// SetServiceProperties sets the properties of your storage account's file service.
-// File service does not support logging
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-file-service-properties
-func (f *FileServiceClient) SetServiceProperties(props ServiceProperties) error {
- return f.client.setServiceProperties(props, fileServiceName, f.auth)
-}
-
-// retrieves directory or share content
-func (f FileServiceClient) listContent(path string, params url.Values, extraHeaders map[string]string) (*http.Response, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return nil, err
- }
-
- uri := f.client.getEndpoint(fileServiceName, path, params)
- extraHeaders = f.client.protectUserAgent(extraHeaders)
- headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
-
- resp, err := f.client.exec(http.MethodGet, uri, headers, nil, f.auth)
- if err != nil {
- return nil, err
- }
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- drainRespBody(resp)
- return nil, err
- }
-
- return resp, nil
-}
-
-// returns true if the specified resource exists
-func (f FileServiceClient) resourceExists(path string, res resourceType) (bool, http.Header, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return false, nil, err
- }
-
- uri := f.client.getEndpoint(fileServiceName, path, getURLInitValues(compNone, res))
- headers := f.client.getStandardHeaders()
-
- resp, err := f.client.exec(http.MethodHead, uri, headers, nil, f.auth)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusOK, resp.Header, nil
- }
- }
- return false, nil, err
-}
-
-// creates a resource depending on the specified resource type
-func (f FileServiceClient) createResource(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string, expectedResponseCodes []int) (http.Header, error) {
- resp, err := f.createResourceNoClose(path, res, urlParams, extraHeaders)
- if err != nil {
- return nil, err
- }
- defer drainRespBody(resp)
- return resp.Header, checkRespCode(resp, expectedResponseCodes)
-}
-
-// creates a resource depending on the specified resource type, doesn't close the response body
-func (f FileServiceClient) createResourceNoClose(path string, res resourceType, urlParams url.Values, extraHeaders map[string]string) (*http.Response, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return nil, err
- }
-
- values := getURLInitValues(compNone, res)
- combinedParams := mergeParams(values, urlParams)
- uri := f.client.getEndpoint(fileServiceName, path, combinedParams)
- extraHeaders = f.client.protectUserAgent(extraHeaders)
- headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
-
- return f.client.exec(http.MethodPut, uri, headers, nil, f.auth)
-}
-
-// returns HTTP header data for the specified directory or share
-func (f FileServiceClient) getResourceHeaders(path string, comp compType, res resourceType, params url.Values, verb string) (http.Header, error) {
- resp, err := f.getResourceNoClose(path, comp, res, params, verb, nil)
- if err != nil {
- return nil, err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
-
- return resp.Header, nil
-}
-
-// gets the specified resource, doesn't close the response body
-func (f FileServiceClient) getResourceNoClose(path string, comp compType, res resourceType, params url.Values, verb string, extraHeaders map[string]string) (*http.Response, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return nil, err
- }
-
- params = mergeParams(params, getURLInitValues(comp, res))
- uri := f.client.getEndpoint(fileServiceName, path, params)
- headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
-
- return f.client.exec(verb, uri, headers, nil, f.auth)
-}
-
-// deletes the resource and returns the response
-func (f FileServiceClient) deleteResource(path string, res resourceType, options *FileRequestOptions) error {
- resp, err := f.deleteResourceNoClose(path, res, options)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusAccepted})
-}
-
-// deletes the resource and returns the response, doesn't close the response body
-func (f FileServiceClient) deleteResourceNoClose(path string, res resourceType, options *FileRequestOptions) (*http.Response, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return nil, err
- }
-
- values := mergeParams(getURLInitValues(compNone, res), prepareOptions(options))
- uri := f.client.getEndpoint(fileServiceName, path, values)
- return f.client.exec(http.MethodDelete, uri, f.client.getStandardHeaders(), nil, f.auth)
-}
-
-// merges metadata into extraHeaders and returns extraHeaders
-func mergeMDIntoExtraHeaders(metadata, extraHeaders map[string]string) map[string]string {
- if metadata == nil && extraHeaders == nil {
- return nil
- }
- if extraHeaders == nil {
- extraHeaders = make(map[string]string)
- }
- for k, v := range metadata {
- extraHeaders[userDefinedMetadataHeaderPrefix+k] = v
- }
- return extraHeaders
-}
-
-// sets extra header data for the specified resource
-func (f FileServiceClient) setResourceHeaders(path string, comp compType, res resourceType, extraHeaders map[string]string, options *FileRequestOptions) (http.Header, error) {
- if err := f.checkForStorageEmulator(); err != nil {
- return nil, err
- }
-
- params := mergeParams(getURLInitValues(comp, res), prepareOptions(options))
- uri := f.client.getEndpoint(fileServiceName, path, params)
- extraHeaders = f.client.protectUserAgent(extraHeaders)
- headers := mergeHeaders(f.client.getStandardHeaders(), extraHeaders)
-
- resp, err := f.client.exec(http.MethodPut, uri, headers, nil, f.auth)
- if err != nil {
- return nil, err
- }
- defer drainRespBody(resp)
-
- return resp.Header, checkRespCode(resp, []int{http.StatusOK})
-}
-
-//checkForStorageEmulator determines if the client is setup for use with
-//Azure Storage Emulator, and returns a relevant error
-func (f FileServiceClient) checkForStorageEmulator() error {
- if f.client.accountName == StorageEmulatorAccountName {
- return fmt.Errorf("Error: File service is not currently supported by Azure Storage Emulator")
- }
- return nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go
deleted file mode 100644
index 6453477ba6..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/leaseblob.go
+++ /dev/null
@@ -1,190 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "errors"
- "net/http"
- "net/url"
- "strconv"
- "time"
-)
-
-// lease constants.
-const (
- leaseHeaderPrefix = "x-ms-lease-"
- headerLeaseID = "x-ms-lease-id"
- leaseAction = "x-ms-lease-action"
- leaseBreakPeriod = "x-ms-lease-break-period"
- leaseDuration = "x-ms-lease-duration"
- leaseProposedID = "x-ms-proposed-lease-id"
- leaseTime = "x-ms-lease-time"
-
- acquireLease = "acquire"
- renewLease = "renew"
- changeLease = "change"
- releaseLease = "release"
- breakLease = "break"
-)
-
-// leasePut is common PUT code for the various acquire/release/break etc functions.
-func (b *Blob) leaseCommonPut(headers map[string]string, expectedStatus int, options *LeaseOptions) (http.Header, error) {
- params := url.Values{"comp": {"lease"}}
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return nil, err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{expectedStatus}); err != nil {
- return nil, err
- }
-
- return resp.Header, nil
-}
-
-// LeaseOptions includes options for all operations regarding leasing blobs
-type LeaseOptions struct {
- Timeout uint
- Origin string `header:"Origin"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// AcquireLease creates a lease for a blob
-// returns leaseID acquired
-// In API Versions starting on 2012-02-12, the minimum leaseTimeInSeconds is 15, the maximum
-// non-infinite leaseTimeInSeconds is 60. To specify an infinite lease, provide the value -1.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob
-func (b *Blob) AcquireLease(leaseTimeInSeconds int, proposedLeaseID string, options *LeaseOptions) (returnedLeaseID string, err error) {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = acquireLease
-
- if leaseTimeInSeconds == -1 {
- // Do nothing, but don't trigger the following clauses.
- } else if leaseTimeInSeconds > 60 || b.Container.bsc.client.apiVersion < "2012-02-12" {
- leaseTimeInSeconds = 60
- } else if leaseTimeInSeconds < 15 {
- leaseTimeInSeconds = 15
- }
-
- headers[leaseDuration] = strconv.Itoa(leaseTimeInSeconds)
-
- if proposedLeaseID != "" {
- headers[leaseProposedID] = proposedLeaseID
- }
-
- respHeaders, err := b.leaseCommonPut(headers, http.StatusCreated, options)
- if err != nil {
- return "", err
- }
-
- returnedLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
-
- if returnedLeaseID != "" {
- return returnedLeaseID, nil
- }
-
- return "", errors.New("LeaseID not returned")
-}
-
-// BreakLease breaks the lease for a blob
-// Returns the timeout remaining in the lease in seconds
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob
-func (b *Blob) BreakLease(options *LeaseOptions) (breakTimeout int, err error) {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = breakLease
- return b.breakLeaseCommon(headers, options)
-}
-
-// BreakLeaseWithBreakPeriod breaks the lease for a blob
-// breakPeriodInSeconds is used to determine how long until new lease can be created.
-// Returns the timeout remaining in the lease in seconds
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob
-func (b *Blob) BreakLeaseWithBreakPeriod(breakPeriodInSeconds int, options *LeaseOptions) (breakTimeout int, err error) {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = breakLease
- headers[leaseBreakPeriod] = strconv.Itoa(breakPeriodInSeconds)
- return b.breakLeaseCommon(headers, options)
-}
-
-// breakLeaseCommon is common code for both version of BreakLease (with and without break period)
-func (b *Blob) breakLeaseCommon(headers map[string]string, options *LeaseOptions) (breakTimeout int, err error) {
-
- respHeaders, err := b.leaseCommonPut(headers, http.StatusAccepted, options)
- if err != nil {
- return 0, err
- }
-
- breakTimeoutStr := respHeaders.Get(http.CanonicalHeaderKey(leaseTime))
- if breakTimeoutStr != "" {
- breakTimeout, err = strconv.Atoi(breakTimeoutStr)
- if err != nil {
- return 0, err
- }
- }
-
- return breakTimeout, nil
-}
-
-// ChangeLease changes a lease ID for a blob
-// Returns the new LeaseID acquired
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob
-func (b *Blob) ChangeLease(currentLeaseID string, proposedLeaseID string, options *LeaseOptions) (newLeaseID string, err error) {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = changeLease
- headers[headerLeaseID] = currentLeaseID
- headers[leaseProposedID] = proposedLeaseID
-
- respHeaders, err := b.leaseCommonPut(headers, http.StatusOK, options)
- if err != nil {
- return "", err
- }
-
- newLeaseID = respHeaders.Get(http.CanonicalHeaderKey(headerLeaseID))
- if newLeaseID != "" {
- return newLeaseID, nil
- }
-
- return "", errors.New("LeaseID not returned")
-}
-
-// ReleaseLease releases the lease for a blob
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Lease-Blob
-func (b *Blob) ReleaseLease(currentLeaseID string, options *LeaseOptions) error {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = releaseLease
- headers[headerLeaseID] = currentLeaseID
-
- _, err := b.leaseCommonPut(headers, http.StatusOK, options)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-// RenewLease renews the lease for a blob as per https://msdn.microsoft.com/en-us/library/azure/ee691972.aspx
-func (b *Blob) RenewLease(currentLeaseID string, options *LeaseOptions) error {
- headers := b.Container.bsc.client.getStandardHeaders()
- headers[leaseAction] = renewLease
- headers[headerLeaseID] = currentLeaseID
-
- _, err := b.leaseCommonPut(headers, http.StatusOK, options)
- if err != nil {
- return err
- }
-
- return nil
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go
deleted file mode 100644
index e5447e4a13..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/message.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "fmt"
- "net/http"
- "net/url"
- "strconv"
- "time"
-)
-
-// Message represents an Azure message.
-type Message struct {
- Queue *Queue
- Text string `xml:"MessageText"`
- ID string `xml:"MessageId"`
- Insertion TimeRFC1123 `xml:"InsertionTime"`
- Expiration TimeRFC1123 `xml:"ExpirationTime"`
- PopReceipt string `xml:"PopReceipt"`
- NextVisible TimeRFC1123 `xml:"TimeNextVisible"`
- DequeueCount int `xml:"DequeueCount"`
-}
-
-func (m *Message) buildPath() string {
- return fmt.Sprintf("%s/%s", m.Queue.buildPathMessages(), m.ID)
-}
-
-// PutMessageOptions is the set of options can be specified for Put Messsage
-// operation. A zero struct does not use any preferences for the request.
-type PutMessageOptions struct {
- Timeout uint
- VisibilityTimeout int
- MessageTTL int
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Put operation adds a new message to the back of the message queue.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Message
-func (m *Message) Put(options *PutMessageOptions) error {
- query := url.Values{}
- headers := m.Queue.qsc.client.getStandardHeaders()
-
- req := putMessageRequest{MessageText: m.Text}
- body, nn, err := xmlMarshal(req)
- if err != nil {
- return err
- }
- headers["Content-Length"] = strconv.Itoa(nn)
-
- if options != nil {
- if options.VisibilityTimeout != 0 {
- query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout))
- }
- if options.MessageTTL != 0 {
- query.Set("messagettl", strconv.Itoa(options.MessageTTL))
- }
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
-
- uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.Queue.buildPathMessages(), query)
- resp, err := m.Queue.qsc.client.exec(http.MethodPost, uri, headers, body, m.Queue.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- err = checkRespCode(resp, []int{http.StatusCreated})
- if err != nil {
- return err
- }
- err = xmlUnmarshal(resp.Body, m)
- if err != nil {
- return err
- }
- return nil
-}
-
-// UpdateMessageOptions is the set of options can be specified for Update Messsage
-// operation. A zero struct does not use any preferences for the request.
-type UpdateMessageOptions struct {
- Timeout uint
- VisibilityTimeout int
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Update operation updates the specified message.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Update-Message
-func (m *Message) Update(options *UpdateMessageOptions) error {
- query := url.Values{}
- if m.PopReceipt != "" {
- query.Set("popreceipt", m.PopReceipt)
- }
-
- headers := m.Queue.qsc.client.getStandardHeaders()
- req := putMessageRequest{MessageText: m.Text}
- body, nn, err := xmlMarshal(req)
- if err != nil {
- return err
- }
- headers["Content-Length"] = strconv.Itoa(nn)
- // visibilitytimeout is required for Update (zero or greater) so set the default here
- query.Set("visibilitytimeout", "0")
- if options != nil {
- if options.VisibilityTimeout != 0 {
- query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout))
- }
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), query)
-
- resp, err := m.Queue.qsc.client.exec(http.MethodPut, uri, headers, body, m.Queue.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- m.PopReceipt = resp.Header.Get("x-ms-popreceipt")
- nextTimeStr := resp.Header.Get("x-ms-time-next-visible")
- if nextTimeStr != "" {
- nextTime, err := time.Parse(time.RFC1123, nextTimeStr)
- if err != nil {
- return err
- }
- m.NextVisible = TimeRFC1123(nextTime)
- }
-
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// Delete operation deletes the specified message.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/dd179347.aspx
-func (m *Message) Delete(options *QueueServiceOptions) error {
- params := url.Values{"popreceipt": {m.PopReceipt}}
- headers := m.Queue.qsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := m.Queue.qsc.client.getEndpoint(queueServiceName, m.buildPath(), params)
-
- resp, err := m.Queue.qsc.client.exec(http.MethodDelete, uri, headers, nil, m.Queue.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-type putMessageRequest struct {
- XMLName xml.Name `xml:"QueueMessage"`
- MessageText string `xml:"MessageText"`
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go
deleted file mode 100644
index 3b05722387..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/odata.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-// MetadataLevel determines if operations should return a paylod,
-// and it level of detail.
-type MetadataLevel string
-
-// This consts are meant to help with Odata supported operations
-const (
- OdataTypeSuffix = "@odata.type"
-
- // Types
-
- OdataBinary = "Edm.Binary"
- OdataDateTime = "Edm.DateTime"
- OdataDouble = "Edm.Double"
- OdataGUID = "Edm.Guid"
- OdataInt64 = "Edm.Int64"
-
- // Query options
-
- OdataFilter = "$filter"
- OdataOrderBy = "$orderby"
- OdataTop = "$top"
- OdataSkip = "$skip"
- OdataCount = "$count"
- OdataExpand = "$expand"
- OdataSelect = "$select"
- OdataSearch = "$search"
-
- EmptyPayload MetadataLevel = ""
- NoMetadata MetadataLevel = "application/json;odata=nometadata"
- MinimalMetadata MetadataLevel = "application/json;odata=minimalmetadata"
- FullMetadata MetadataLevel = "application/json;odata=fullmetadata"
-)
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go
deleted file mode 100644
index ff93ec2ac9..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/pageblob.go
+++ /dev/null
@@ -1,192 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "errors"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "time"
-)
-
-// GetPageRangesResponse contains the response fields from
-// Get Page Ranges call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx
-type GetPageRangesResponse struct {
- XMLName xml.Name `xml:"PageList"`
- PageList []PageRange `xml:"PageRange"`
-}
-
-// PageRange contains information about a page of a page blob from
-// Get Pages Range call.
-//
-// See https://msdn.microsoft.com/en-us/library/azure/ee691973.aspx
-type PageRange struct {
- Start int64 `xml:"Start"`
- End int64 `xml:"End"`
-}
-
-var (
- errBlobCopyAborted = errors.New("storage: blob copy is aborted")
- errBlobCopyIDMismatch = errors.New("storage: blob copy id is a mismatch")
-)
-
-// PutPageOptions includes the options for a put page operation
-type PutPageOptions struct {
- Timeout uint
- LeaseID string `header:"x-ms-lease-id"`
- IfSequenceNumberLessThanOrEqualTo *int `header:"x-ms-if-sequence-number-le"`
- IfSequenceNumberLessThan *int `header:"x-ms-if-sequence-number-lt"`
- IfSequenceNumberEqualTo *int `header:"x-ms-if-sequence-number-eq"`
- IfModifiedSince *time.Time `header:"If-Modified-Since"`
- IfUnmodifiedSince *time.Time `header:"If-Unmodified-Since"`
- IfMatch string `header:"If-Match"`
- IfNoneMatch string `header:"If-None-Match"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// WriteRange writes a range of pages to a page blob.
-// Ranges must be aligned with 512-byte boundaries and chunk must be of size
-// multiplies by 512.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page
-func (b *Blob) WriteRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error {
- if bytes == nil {
- return errors.New("bytes cannot be nil")
- }
- return b.modifyRange(blobRange, bytes, options)
-}
-
-// ClearRange clears the given range in a page blob.
-// Ranges must be aligned with 512-byte boundaries and chunk must be of size
-// multiplies by 512.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Page
-func (b *Blob) ClearRange(blobRange BlobRange, options *PutPageOptions) error {
- return b.modifyRange(blobRange, nil, options)
-}
-
-func (b *Blob) modifyRange(blobRange BlobRange, bytes io.Reader, options *PutPageOptions) error {
- if blobRange.End < blobRange.Start {
- return errors.New("the value for rangeEnd must be greater than or equal to rangeStart")
- }
- if blobRange.Start%512 != 0 {
- return errors.New("the value for rangeStart must be a multiple of 512")
- }
- if blobRange.End%512 != 511 {
- return errors.New("the value for rangeEnd must be a multiple of 512 - 1")
- }
-
- params := url.Values{"comp": {"page"}}
-
- // default to clear
- write := "clear"
- var cl uint64
-
- // if bytes is not nil then this is an update operation
- if bytes != nil {
- write = "update"
- cl = (blobRange.End - blobRange.Start) + 1
- }
-
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-blob-type"] = string(BlobTypePage)
- headers["x-ms-page-write"] = write
- headers["x-ms-range"] = blobRange.String()
- headers["Content-Length"] = fmt.Sprintf("%v", cl)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, bytes, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusCreated})
-}
-
-// GetPageRangesOptions includes the options for a get page ranges operation
-type GetPageRangesOptions struct {
- Timeout uint
- Snapshot *time.Time
- PreviousSnapshot *time.Time
- Range *BlobRange
- LeaseID string `header:"x-ms-lease-id"`
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetPageRanges returns the list of valid page ranges for a page blob.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Page-Ranges
-func (b *Blob) GetPageRanges(options *GetPageRangesOptions) (GetPageRangesResponse, error) {
- params := url.Values{"comp": {"pagelist"}}
- headers := b.Container.bsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- params = addSnapshot(params, options.Snapshot)
- if options.PreviousSnapshot != nil {
- params.Add("prevsnapshot", timeRFC3339Formatted(*options.PreviousSnapshot))
- }
- if options.Range != nil {
- headers["Range"] = options.Range.String()
- }
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- var out GetPageRangesResponse
- resp, err := b.Container.bsc.client.exec(http.MethodGet, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return out, err
- }
- defer drainRespBody(resp)
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return out, err
- }
- err = xmlUnmarshal(resp.Body, &out)
- return out, err
-}
-
-// PutPageBlob initializes an empty page blob with specified name and maximum
-// size in bytes (size must be aligned to a 512-byte boundary). A page blob must
-// be created using this method before writing pages.
-//
-// See CreateBlockBlobFromReader for more info on creating blobs.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Put-Blob
-func (b *Blob) PutPageBlob(options *PutBlobOptions) error {
- if b.Properties.ContentLength%512 != 0 {
- return errors.New("Content length must be aligned to a 512-byte boundary")
- }
-
- params := url.Values{}
- headers := b.Container.bsc.client.getStandardHeaders()
- headers["x-ms-blob-type"] = string(BlobTypePage)
- headers["x-ms-blob-content-length"] = fmt.Sprintf("%v", b.Properties.ContentLength)
- headers["x-ms-blob-sequence-number"] = fmt.Sprintf("%v", b.Properties.SequenceNumber)
- headers = mergeHeaders(headers, headersFromStruct(b.Properties))
- headers = b.Container.bsc.client.addMetadataToHeaders(headers, b.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := b.Container.bsc.client.getEndpoint(blobServiceName, b.buildPath(), params)
-
- resp, err := b.Container.bsc.client.exec(http.MethodPut, uri, headers, nil, b.Container.bsc.auth)
- if err != nil {
- return err
- }
- return b.respondCreation(resp, BlobTypePage)
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
deleted file mode 100644
index 7731e4ebc1..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queue.go
+++ /dev/null
@@ -1,425 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/xml"
- "fmt"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "time"
-)
-
-const (
- // casing is per Golang's http.Header canonicalizing the header names.
- approximateMessagesCountHeader = "X-Ms-Approximate-Messages-Count"
-)
-
-// QueueAccessPolicy represents each access policy in the queue ACL.
-type QueueAccessPolicy struct {
- ID string
- StartTime time.Time
- ExpiryTime time.Time
- CanRead bool
- CanAdd bool
- CanUpdate bool
- CanProcess bool
-}
-
-// QueuePermissions represents the queue ACLs.
-type QueuePermissions struct {
- AccessPolicies []QueueAccessPolicy
-}
-
-// SetQueuePermissionOptions includes options for a set queue permissions operation
-type SetQueuePermissionOptions struct {
- Timeout uint
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Queue represents an Azure queue.
-type Queue struct {
- qsc *QueueServiceClient
- Name string
- Metadata map[string]string
- AproxMessageCount uint64
-}
-
-func (q *Queue) buildPath() string {
- return fmt.Sprintf("/%s", q.Name)
-}
-
-func (q *Queue) buildPathMessages() string {
- return fmt.Sprintf("%s/messages", q.buildPath())
-}
-
-// QueueServiceOptions includes options for some queue service operations
-type QueueServiceOptions struct {
- Timeout uint
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// Create operation creates a queue under the given account.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Queue4
-func (q *Queue) Create(options *QueueServiceOptions) error {
- params := url.Values{}
- headers := q.qsc.client.getStandardHeaders()
- headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
-
- resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusCreated})
-}
-
-// Delete operation permanently deletes the specified queue.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Queue3
-func (q *Queue) Delete(options *QueueServiceOptions) error {
- params := url.Values{}
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
- resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// Exists returns true if a queue with given name exists.
-func (q *Queue) Exists() (bool, error) {
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), url.Values{"comp": {"metadata"}})
- resp, err := q.qsc.client.exec(http.MethodGet, uri, q.qsc.client.getStandardHeaders(), nil, q.qsc.auth)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusOK, nil
- }
- err = getErrorFromResponse(resp)
- }
- return false, err
-}
-
-// SetMetadata operation sets user-defined metadata on the specified queue.
-// Metadata is associated with the queue as name-value pairs.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata
-func (q *Queue) SetMetadata(options *QueueServiceOptions) error {
- params := url.Values{"comp": {"metadata"}}
- headers := q.qsc.client.getStandardHeaders()
- headers = q.qsc.client.addMetadataToHeaders(headers, q.Metadata)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
-
- resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// GetMetadata operation retrieves user-defined metadata and queue
-// properties on the specified queue. Metadata is associated with
-// the queue as name-values pairs.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Queue-Metadata
-//
-// Because the way Golang's http client (and http.Header in particular)
-// canonicalize header names, the returned metadata names would always
-// be all lower case.
-func (q *Queue) GetMetadata(options *QueueServiceOptions) error {
- params := url.Values{"comp": {"metadata"}}
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
-
- resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- aproxMessagesStr := resp.Header.Get(http.CanonicalHeaderKey(approximateMessagesCountHeader))
- if aproxMessagesStr != "" {
- aproxMessages, err := strconv.ParseUint(aproxMessagesStr, 10, 64)
- if err != nil {
- return err
- }
- q.AproxMessageCount = aproxMessages
- }
-
- q.Metadata = getMetadataFromHeaders(resp.Header)
- return nil
-}
-
-// GetMessageReference returns a message object with the specified text.
-func (q *Queue) GetMessageReference(text string) *Message {
- return &Message{
- Queue: q,
- Text: text,
- }
-}
-
-// GetMessagesOptions is the set of options can be specified for Get
-// Messsages operation. A zero struct does not use any preferences for the
-// request.
-type GetMessagesOptions struct {
- Timeout uint
- NumOfMessages int
- VisibilityTimeout int
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-type messages struct {
- XMLName xml.Name `xml:"QueueMessagesList"`
- Messages []Message `xml:"QueueMessage"`
-}
-
-// GetMessages operation retrieves one or more messages from the front of the
-// queue.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Get-Messages
-func (q *Queue) GetMessages(options *GetMessagesOptions) ([]Message, error) {
- query := url.Values{}
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- if options.NumOfMessages != 0 {
- query.Set("numofmessages", strconv.Itoa(options.NumOfMessages))
- }
- if options.VisibilityTimeout != 0 {
- query.Set("visibilitytimeout", strconv.Itoa(options.VisibilityTimeout))
- }
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query)
-
- resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return []Message{}, err
- }
- defer resp.Body.Close()
-
- var out messages
- err = xmlUnmarshal(resp.Body, &out)
- if err != nil {
- return []Message{}, err
- }
- for i := range out.Messages {
- out.Messages[i].Queue = q
- }
- return out.Messages, err
-}
-
-// PeekMessagesOptions is the set of options can be specified for Peek
-// Messsage operation. A zero struct does not use any preferences for the
-// request.
-type PeekMessagesOptions struct {
- Timeout uint
- NumOfMessages int
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// PeekMessages retrieves one or more messages from the front of the queue, but
-// does not alter the visibility of the message.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Peek-Messages
-func (q *Queue) PeekMessages(options *PeekMessagesOptions) ([]Message, error) {
- query := url.Values{"peekonly": {"true"}} // Required for peek operation
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- if options.NumOfMessages != 0 {
- query.Set("numofmessages", strconv.Itoa(options.NumOfMessages))
- }
- query = addTimeout(query, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), query)
-
- resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return []Message{}, err
- }
- defer resp.Body.Close()
-
- var out messages
- err = xmlUnmarshal(resp.Body, &out)
- if err != nil {
- return []Message{}, err
- }
- for i := range out.Messages {
- out.Messages[i].Queue = q
- }
- return out.Messages, err
-}
-
-// ClearMessages operation deletes all messages from the specified queue.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Clear-Messages
-func (q *Queue) ClearMessages(options *QueueServiceOptions) error {
- params := url.Values{}
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPathMessages(), params)
-
- resp, err := q.qsc.client.exec(http.MethodDelete, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// SetPermissions sets up queue permissions
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-acl
-func (q *Queue) SetPermissions(permissions QueuePermissions, options *SetQueuePermissionOptions) error {
- body, length, err := generateQueueACLpayload(permissions.AccessPolicies)
- if err != nil {
- return err
- }
-
- params := url.Values{
- "comp": {"acl"},
- }
- headers := q.qsc.client.getStandardHeaders()
- headers["Content-Length"] = strconv.Itoa(length)
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
- resp, err := q.qsc.client.exec(http.MethodPut, uri, headers, body, q.qsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-func generateQueueACLpayload(policies []QueueAccessPolicy) (io.Reader, int, error) {
- sil := SignedIdentifiers{
- SignedIdentifiers: []SignedIdentifier{},
- }
- for _, qapd := range policies {
- permission := qapd.generateQueuePermissions()
- signedIdentifier := convertAccessPolicyToXMLStructs(qapd.ID, qapd.StartTime, qapd.ExpiryTime, permission)
- sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier)
- }
- return xmlMarshal(sil)
-}
-
-func (qapd *QueueAccessPolicy) generateQueuePermissions() (permissions string) {
- // generate the permissions string (raup).
- // still want the end user API to have bool flags.
- permissions = ""
-
- if qapd.CanRead {
- permissions += "r"
- }
-
- if qapd.CanAdd {
- permissions += "a"
- }
-
- if qapd.CanUpdate {
- permissions += "u"
- }
-
- if qapd.CanProcess {
- permissions += "p"
- }
-
- return permissions
-}
-
-// GetQueuePermissionOptions includes options for a get queue permissions operation
-type GetQueuePermissionOptions struct {
- Timeout uint
- RequestID string `header:"x-ms-client-request-id"`
-}
-
-// GetPermissions gets the queue permissions as per https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-acl
-// If timeout is 0 then it will not be passed to Azure
-func (q *Queue) GetPermissions(options *GetQueuePermissionOptions) (*QueuePermissions, error) {
- params := url.Values{
- "comp": {"acl"},
- }
- headers := q.qsc.client.getStandardHeaders()
-
- if options != nil {
- params = addTimeout(params, options.Timeout)
- headers = mergeHeaders(headers, headersFromStruct(*options))
- }
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), params)
- resp, err := q.qsc.client.exec(http.MethodGet, uri, headers, nil, q.qsc.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- var ap AccessPolicy
- err = xmlUnmarshal(resp.Body, &ap.SignedIdentifiersList)
- if err != nil {
- return nil, err
- }
- return buildQueueAccessPolicy(ap, &resp.Header), nil
-}
-
-func buildQueueAccessPolicy(ap AccessPolicy, headers *http.Header) *QueuePermissions {
- permissions := QueuePermissions{
- AccessPolicies: []QueueAccessPolicy{},
- }
-
- for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers {
- qapd := QueueAccessPolicy{
- ID: policy.ID,
- StartTime: policy.AccessPolicy.StartTime,
- ExpiryTime: policy.AccessPolicy.ExpiryTime,
- }
- qapd.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r")
- qapd.CanAdd = updatePermissions(policy.AccessPolicy.Permission, "a")
- qapd.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u")
- qapd.CanProcess = updatePermissions(policy.AccessPolicy.Permission, "p")
-
- permissions.AccessPolicies = append(permissions.AccessPolicies, qapd)
- }
- return &permissions
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queuesasuri.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queuesasuri.go
deleted file mode 100644
index ab39f956fb..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queuesasuri.go
+++ /dev/null
@@ -1,135 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "errors"
- "fmt"
- "net/url"
- "strings"
- "time"
-)
-
-// QueueSASOptions are options to construct a blob SAS
-// URI.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-type QueueSASOptions struct {
- QueueSASPermissions
- SASOptions
-}
-
-// QueueSASPermissions includes the available permissions for
-// a queue SAS URI.
-type QueueSASPermissions struct {
- Read bool
- Add bool
- Update bool
- Process bool
-}
-
-func (q QueueSASPermissions) buildString() string {
- permissions := ""
-
- if q.Read {
- permissions += "r"
- }
- if q.Add {
- permissions += "a"
- }
- if q.Update {
- permissions += "u"
- }
- if q.Process {
- permissions += "p"
- }
- return permissions
-}
-
-// GetSASURI creates an URL to the specified queue which contains the Shared
-// Access Signature with specified permissions and expiration time.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas
-func (q *Queue) GetSASURI(options QueueSASOptions) (string, error) {
- canonicalizedResource, err := q.qsc.client.buildCanonicalizedResource(q.buildPath(), q.qsc.auth, true)
- if err != nil {
- return "", err
- }
-
- // "The canonicalizedresouce portion of the string is a canonical path to the signed resource.
- // It must include the service name (blob, table, queue or file) for version 2015-02-21 or
- // later, the storage account name, and the resource name, and must be URL-decoded.
- // -- https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx
- // We need to replace + with %2b first to avoid being treated as a space (which is correct for query strings, but not the path component).
- canonicalizedResource = strings.Replace(canonicalizedResource, "+", "%2b", -1)
- canonicalizedResource, err = url.QueryUnescape(canonicalizedResource)
- if err != nil {
- return "", err
- }
-
- signedStart := ""
- if options.Start != (time.Time{}) {
- signedStart = options.Start.UTC().Format(time.RFC3339)
- }
- signedExpiry := options.Expiry.UTC().Format(time.RFC3339)
-
- protocols := "https,http"
- if options.UseHTTPS {
- protocols = "https"
- }
-
- permissions := options.QueueSASPermissions.buildString()
- stringToSign, err := queueSASStringToSign(q.qsc.client.apiVersion, canonicalizedResource, signedStart, signedExpiry, options.IP, permissions, protocols, options.Identifier)
- if err != nil {
- return "", err
- }
-
- sig := q.qsc.client.computeHmac256(stringToSign)
- sasParams := url.Values{
- "sv": {q.qsc.client.apiVersion},
- "se": {signedExpiry},
- "sp": {permissions},
- "sig": {sig},
- }
-
- if q.qsc.client.apiVersion >= "2015-04-05" {
- sasParams.Add("spr", protocols)
- addQueryParameter(sasParams, "sip", options.IP)
- }
-
- uri := q.qsc.client.getEndpoint(queueServiceName, q.buildPath(), nil)
- sasURL, err := url.Parse(uri)
- if err != nil {
- return "", err
- }
- sasURL.RawQuery = sasParams.Encode()
- return sasURL.String(), nil
-}
-
-func queueSASStringToSign(signedVersion, canonicalizedResource, signedStart, signedExpiry, signedIP, signedPermissions, protocols, signedIdentifier string) (string, error) {
-
- if signedVersion >= "2015-02-21" {
- canonicalizedResource = "/queue" + canonicalizedResource
- }
-
- // https://msdn.microsoft.com/en-us/library/azure/dn140255.aspx#Anchor_12
- if signedVersion >= "2015-04-05" {
- return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s",
- signedPermissions,
- signedStart,
- signedExpiry,
- canonicalizedResource,
- signedIdentifier,
- signedIP,
- protocols,
- signedVersion), nil
-
- }
-
- // reference: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx
- if signedVersion >= "2013-08-15" {
- return fmt.Sprintf("%s\n%s\n%s\n%s\n%s\n%s", signedPermissions, signedStart, signedExpiry, canonicalizedResource, signedIdentifier, signedVersion), nil
- }
-
- return "", errors.New("storage: not implemented SAS for versions earlier than 2013-08-15")
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go
deleted file mode 100644
index 752701c3bd..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/queueserviceclient.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-// QueueServiceClient contains operations for Microsoft Azure Queue Storage
-// Service.
-type QueueServiceClient struct {
- client Client
- auth authentication
-}
-
-// GetServiceProperties gets the properties of your storage account's queue service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-queue-service-properties
-func (q *QueueServiceClient) GetServiceProperties() (*ServiceProperties, error) {
- return q.client.getServiceProperties(queueServiceName, q.auth)
-}
-
-// SetServiceProperties sets the properties of your storage account's queue service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-queue-service-properties
-func (q *QueueServiceClient) SetServiceProperties(props ServiceProperties) error {
- return q.client.setServiceProperties(props, queueServiceName, q.auth)
-}
-
-// GetQueueReference returns a Container object for the specified queue name.
-func (q *QueueServiceClient) GetQueueReference(name string) *Queue {
- return &Queue{
- qsc: q,
- Name: name,
- }
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go
deleted file mode 100644
index 30f7c14350..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/share.go
+++ /dev/null
@@ -1,205 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "fmt"
- "net/http"
- "net/url"
- "strconv"
-)
-
-// Share represents an Azure file share.
-type Share struct {
- fsc *FileServiceClient
- Name string `xml:"Name"`
- Properties ShareProperties `xml:"Properties"`
- Metadata map[string]string
-}
-
-// ShareProperties contains various properties of a share.
-type ShareProperties struct {
- LastModified string `xml:"Last-Modified"`
- Etag string `xml:"Etag"`
- Quota int `xml:"Quota"`
-}
-
-// builds the complete path for this share object.
-func (s *Share) buildPath() string {
- return fmt.Sprintf("/%s", s.Name)
-}
-
-// Create this share under the associated account.
-// If a share with the same name already exists, the operation fails.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share
-func (s *Share) Create(options *FileRequestOptions) error {
- extraheaders := map[string]string{}
- if s.Properties.Quota > 0 {
- extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota)
- }
-
- params := prepareOptions(options)
- headers, err := s.fsc.createResource(s.buildPath(), resourceShare, params, mergeMDIntoExtraHeaders(s.Metadata, extraheaders), []int{http.StatusCreated})
- if err != nil {
- return err
- }
-
- s.updateEtagAndLastModified(headers)
- return nil
-}
-
-// CreateIfNotExists creates this share under the associated account if
-// it does not exist. Returns true if the share is newly created or false if
-// the share already exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Create-Share
-func (s *Share) CreateIfNotExists(options *FileRequestOptions) (bool, error) {
- extraheaders := map[string]string{}
- if s.Properties.Quota > 0 {
- extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota)
- }
-
- params := prepareOptions(options)
- resp, err := s.fsc.createResourceNoClose(s.buildPath(), resourceShare, params, extraheaders)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusCreated || resp.StatusCode == http.StatusConflict {
- if resp.StatusCode == http.StatusCreated {
- s.updateEtagAndLastModified(resp.Header)
- return true, nil
- }
- return false, s.FetchAttributes(nil)
- }
- }
-
- return false, err
-}
-
-// Delete marks this share for deletion. The share along with any files
-// and directories contained within it are later deleted during garbage
-// collection. If the share does not exist the operation fails
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share
-func (s *Share) Delete(options *FileRequestOptions) error {
- return s.fsc.deleteResource(s.buildPath(), resourceShare, options)
-}
-
-// DeleteIfExists operation marks this share for deletion if it exists.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Delete-Share
-func (s *Share) DeleteIfExists(options *FileRequestOptions) (bool, error) {
- resp, err := s.fsc.deleteResourceNoClose(s.buildPath(), resourceShare, options)
- if resp != nil {
- defer drainRespBody(resp)
- if resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusNotFound {
- return resp.StatusCode == http.StatusAccepted, nil
- }
- }
- return false, err
-}
-
-// Exists returns true if this share already exists
-// on the storage account, otherwise returns false.
-func (s *Share) Exists() (bool, error) {
- exists, headers, err := s.fsc.resourceExists(s.buildPath(), resourceShare)
- if exists {
- s.updateEtagAndLastModified(headers)
- s.updateQuota(headers)
- }
- return exists, err
-}
-
-// FetchAttributes retrieves metadata and properties for this share.
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-share-properties
-func (s *Share) FetchAttributes(options *FileRequestOptions) error {
- params := prepareOptions(options)
- headers, err := s.fsc.getResourceHeaders(s.buildPath(), compNone, resourceShare, params, http.MethodHead)
- if err != nil {
- return err
- }
-
- s.updateEtagAndLastModified(headers)
- s.updateQuota(headers)
- s.Metadata = getMetadataFromHeaders(headers)
-
- return nil
-}
-
-// GetRootDirectoryReference returns a Directory object at the root of this share.
-func (s *Share) GetRootDirectoryReference() *Directory {
- return &Directory{
- fsc: s.fsc,
- share: s,
- }
-}
-
-// ServiceClient returns the FileServiceClient associated with this share.
-func (s *Share) ServiceClient() *FileServiceClient {
- return s.fsc
-}
-
-// SetMetadata replaces the metadata for this share.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by GetShareMetadata. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-share-metadata
-func (s *Share) SetMetadata(options *FileRequestOptions) error {
- headers, err := s.fsc.setResourceHeaders(s.buildPath(), compMetadata, resourceShare, mergeMDIntoExtraHeaders(s.Metadata, nil), options)
- if err != nil {
- return err
- }
-
- s.updateEtagAndLastModified(headers)
- return nil
-}
-
-// SetProperties sets system properties for this share.
-//
-// Some keys may be converted to Camel-Case before sending. All keys
-// are returned in lower case by SetShareProperties. HTTP header names
-// are case-insensitive so case munging should not matter to other
-// applications either.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/Set-Share-Properties
-func (s *Share) SetProperties(options *FileRequestOptions) error {
- extraheaders := map[string]string{}
- if s.Properties.Quota > 0 {
- if s.Properties.Quota > 5120 {
- return fmt.Errorf("invalid value %v for quota, valid values are [1, 5120]", s.Properties.Quota)
- }
- extraheaders["x-ms-share-quota"] = strconv.Itoa(s.Properties.Quota)
- }
-
- headers, err := s.fsc.setResourceHeaders(s.buildPath(), compProperties, resourceShare, extraheaders, options)
- if err != nil {
- return err
- }
-
- s.updateEtagAndLastModified(headers)
- return nil
-}
-
-// updates Etag and last modified date
-func (s *Share) updateEtagAndLastModified(headers http.Header) {
- s.Properties.Etag = headers.Get("Etag")
- s.Properties.LastModified = headers.Get("Last-Modified")
-}
-
-// updates quota value
-func (s *Share) updateQuota(headers http.Header) {
- quota, err := strconv.Atoi(headers.Get("x-ms-share-quota"))
- if err == nil {
- s.Properties.Quota = quota
- }
-}
-
-// URL gets the canonical URL to this share. This method does not create a publicly accessible
-// URL if the share is private and this method does not check if the share exists.
-func (s *Share) URL() string {
- return s.fsc.client.getEndpoint(fileServiceName, s.buildPath(), url.Values{})
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go
deleted file mode 100644
index 35d13670cb..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storagepolicy.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "strings"
- "time"
-)
-
-// AccessPolicyDetailsXML has specifics about an access policy
-// annotated with XML details.
-type AccessPolicyDetailsXML struct {
- StartTime time.Time `xml:"Start"`
- ExpiryTime time.Time `xml:"Expiry"`
- Permission string `xml:"Permission"`
-}
-
-// SignedIdentifier is a wrapper for a specific policy
-type SignedIdentifier struct {
- ID string `xml:"Id"`
- AccessPolicy AccessPolicyDetailsXML `xml:"AccessPolicy"`
-}
-
-// SignedIdentifiers part of the response from GetPermissions call.
-type SignedIdentifiers struct {
- SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
-}
-
-// AccessPolicy is the response type from the GetPermissions call.
-type AccessPolicy struct {
- SignedIdentifiersList SignedIdentifiers `xml:"SignedIdentifiers"`
-}
-
-// convertAccessPolicyToXMLStructs converts between AccessPolicyDetails which is a struct better for API usage to the
-// AccessPolicy struct which will get converted to XML.
-func convertAccessPolicyToXMLStructs(id string, startTime time.Time, expiryTime time.Time, permissions string) SignedIdentifier {
- return SignedIdentifier{
- ID: id,
- AccessPolicy: AccessPolicyDetailsXML{
- StartTime: startTime.UTC().Round(time.Second),
- ExpiryTime: expiryTime.UTC().Round(time.Second),
- Permission: permissions,
- },
- }
-}
-
-func updatePermissions(permissions, permission string) bool {
- return strings.Contains(permissions, permission)
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go
deleted file mode 100644
index d139db7765..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/storageservice.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "net/http"
- "net/url"
- "strconv"
-)
-
-// ServiceProperties represents the storage account service properties
-type ServiceProperties struct {
- Logging *Logging
- HourMetrics *Metrics
- MinuteMetrics *Metrics
- Cors *Cors
- DeleteRetentionPolicy *RetentionPolicy // blob storage only
- StaticWebsite *StaticWebsite // blob storage only
-}
-
-// Logging represents the Azure Analytics Logging settings
-type Logging struct {
- Version string
- Delete bool
- Read bool
- Write bool
- RetentionPolicy *RetentionPolicy
-}
-
-// RetentionPolicy indicates if retention is enabled and for how many days
-type RetentionPolicy struct {
- Enabled bool
- Days *int
-}
-
-// Metrics provide request statistics.
-type Metrics struct {
- Version string
- Enabled bool
- IncludeAPIs *bool
- RetentionPolicy *RetentionPolicy
-}
-
-// Cors includes all the CORS rules
-type Cors struct {
- CorsRule []CorsRule
-}
-
-// CorsRule includes all settings for a Cors rule
-type CorsRule struct {
- AllowedOrigins string
- AllowedMethods string
- MaxAgeInSeconds int
- ExposedHeaders string
- AllowedHeaders string
-}
-
-// StaticWebsite - The properties that enable an account to host a static website
-type StaticWebsite struct {
- // Enabled - Indicates whether this account is hosting a static website
- Enabled bool
- // IndexDocument - The default name of the index page under each directory
- IndexDocument *string
- // ErrorDocument404Path - The absolute path of the custom 404 page
- ErrorDocument404Path *string
-}
-
-func (c Client) getServiceProperties(service string, auth authentication) (*ServiceProperties, error) {
- query := url.Values{
- "restype": {"service"},
- "comp": {"properties"},
- }
- uri := c.getEndpoint(service, "", query)
- headers := c.getStandardHeaders()
-
- resp, err := c.exec(http.MethodGet, uri, headers, nil, auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
-
- var out ServiceProperties
- err = xmlUnmarshal(resp.Body, &out)
- if err != nil {
- return nil, err
- }
-
- return &out, nil
-}
-
-func (c Client) setServiceProperties(props ServiceProperties, service string, auth authentication) error {
- query := url.Values{
- "restype": {"service"},
- "comp": {"properties"},
- }
- uri := c.getEndpoint(service, "", query)
-
- // Ideally, StorageServiceProperties would be the output struct
- // This is to avoid golint stuttering, while generating the correct XML
- type StorageServiceProperties struct {
- Logging *Logging
- HourMetrics *Metrics
- MinuteMetrics *Metrics
- Cors *Cors
- DeleteRetentionPolicy *RetentionPolicy
- StaticWebsite *StaticWebsite
- }
- input := StorageServiceProperties{
- Logging: props.Logging,
- HourMetrics: props.HourMetrics,
- MinuteMetrics: props.MinuteMetrics,
- Cors: props.Cors,
- }
- // only set these fields for blob storage else it's invalid XML
- if service == blobServiceName {
- input.DeleteRetentionPolicy = props.DeleteRetentionPolicy
- input.StaticWebsite = props.StaticWebsite
- }
-
- body, length, err := xmlMarshal(input)
- if err != nil {
- return err
- }
-
- headers := c.getStandardHeaders()
- headers["Content-Length"] = strconv.Itoa(length)
-
- resp, err := c.exec(http.MethodPut, uri, headers, body, auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
- return checkRespCode(resp, []int{http.StatusAccepted})
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go
deleted file mode 100644
index fc8631ee20..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table.go
+++ /dev/null
@@ -1,412 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- "time"
-)
-
-const (
- tablesURIPath = "/Tables"
- nextTableQueryParameter = "NextTableName"
- headerNextPartitionKey = "x-ms-continuation-NextPartitionKey"
- headerNextRowKey = "x-ms-continuation-NextRowKey"
- nextPartitionKeyQueryParameter = "NextPartitionKey"
- nextRowKeyQueryParameter = "NextRowKey"
-)
-
-// TableAccessPolicy are used for SETTING table policies
-type TableAccessPolicy struct {
- ID string
- StartTime time.Time
- ExpiryTime time.Time
- CanRead bool
- CanAppend bool
- CanUpdate bool
- CanDelete bool
-}
-
-// Table represents an Azure table.
-type Table struct {
- tsc *TableServiceClient
- Name string `json:"TableName"`
- OdataEditLink string `json:"odata.editLink"`
- OdataID string `json:"odata.id"`
- OdataMetadata string `json:"odata.metadata"`
- OdataType string `json:"odata.type"`
-}
-
-// EntityQueryResult contains the response from
-// ExecuteQuery and ExecuteQueryNextResults functions.
-type EntityQueryResult struct {
- OdataMetadata string `json:"odata.metadata"`
- Entities []*Entity `json:"value"`
- QueryNextLink
- table *Table
-}
-
-type continuationToken struct {
- NextPartitionKey string
- NextRowKey string
-}
-
-func (t *Table) buildPath() string {
- return fmt.Sprintf("/%s", t.Name)
-}
-
-func (t *Table) buildSpecificPath() string {
- return fmt.Sprintf("%s('%s')", tablesURIPath, t.Name)
-}
-
-// Get gets the referenced table.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/querying-tables-and-entities
-func (t *Table) Get(timeout uint, ml MetadataLevel) error {
- if ml == EmptyPayload {
- return errEmptyPayload
- }
-
- query := url.Values{
- "timeout": {strconv.FormatUint(uint64(timeout), 10)},
- }
- headers := t.tsc.client.getStandardHeaders()
- headers[headerAccept] = string(ml)
-
- uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), query)
- resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return err
- }
-
- respBody, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- err = json.Unmarshal(respBody, t)
- if err != nil {
- return err
- }
- return nil
-}
-
-// Create creates the referenced table.
-// This function fails if the name is not compliant
-// with the specification or the tables already exists.
-// ml determines the level of detail of metadata in the operation response,
-// or no data at all.
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/create-table
-func (t *Table) Create(timeout uint, ml MetadataLevel, options *TableOptions) error {
- uri := t.tsc.client.getEndpoint(tableServiceName, tablesURIPath, url.Values{
- "timeout": {strconv.FormatUint(uint64(timeout), 10)},
- })
-
- type createTableRequest struct {
- TableName string `json:"TableName"`
- }
- req := createTableRequest{TableName: t.Name}
- buf := new(bytes.Buffer)
- if err := json.NewEncoder(buf).Encode(req); err != nil {
- return err
- }
-
- headers := t.tsc.client.getStandardHeaders()
- headers = addReturnContentHeaders(headers, ml)
- headers = addBodyRelatedHeaders(headers, buf.Len())
- headers = options.addToHeaders(headers)
-
- resp, err := t.tsc.client.exec(http.MethodPost, uri, headers, buf, t.tsc.auth)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
-
- if ml == EmptyPayload {
- if err := checkRespCode(resp, []int{http.StatusNoContent}); err != nil {
- return err
- }
- } else {
- if err := checkRespCode(resp, []int{http.StatusCreated}); err != nil {
- return err
- }
- }
-
- if ml != EmptyPayload {
- data, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return err
- }
- err = json.Unmarshal(data, t)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-// Delete deletes the referenced table.
-// This function fails if the table is not present.
-// Be advised: Delete deletes all the entries that may be present.
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/delete-table
-func (t *Table) Delete(timeout uint, options *TableOptions) error {
- uri := t.tsc.client.getEndpoint(tableServiceName, t.buildSpecificPath(), url.Values{
- "timeout": {strconv.Itoa(int(timeout))},
- })
-
- headers := t.tsc.client.getStandardHeaders()
- headers = addReturnContentHeaders(headers, EmptyPayload)
- headers = options.addToHeaders(headers)
-
- resp, err := t.tsc.client.exec(http.MethodDelete, uri, headers, nil, t.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-// QueryOptions includes options for a query entities operation.
-// Top, filter and select are OData query options.
-type QueryOptions struct {
- Top uint
- Filter string
- Select []string
- RequestID string
-}
-
-func (options *QueryOptions) getParameters() (url.Values, map[string]string) {
- query := url.Values{}
- headers := map[string]string{}
- if options != nil {
- if options.Top > 0 {
- query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10))
- }
- if options.Filter != "" {
- query.Add(OdataFilter, options.Filter)
- }
- if len(options.Select) > 0 {
- query.Add(OdataSelect, strings.Join(options.Select, ","))
- }
- headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID)
- }
- return query, headers
-}
-
-// QueryEntities returns the entities in the table.
-// You can use query options defined by the OData Protocol specification.
-//
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities
-func (t *Table) QueryEntities(timeout uint, ml MetadataLevel, options *QueryOptions) (*EntityQueryResult, error) {
- if ml == EmptyPayload {
- return nil, errEmptyPayload
- }
- query, headers := options.getParameters()
- query = addTimeout(query, timeout)
- uri := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), query)
- return t.queryEntities(uri, headers, ml)
-}
-
-// NextResults returns the next page of results
-// from a QueryEntities or NextResults operation.
-//
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-entities
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination
-func (eqr *EntityQueryResult) NextResults(options *TableOptions) (*EntityQueryResult, error) {
- if eqr == nil {
- return nil, errNilPreviousResult
- }
- if eqr.NextLink == nil {
- return nil, errNilNextLink
- }
- headers := options.addToHeaders(map[string]string{})
- return eqr.table.queryEntities(*eqr.NextLink, headers, eqr.ml)
-}
-
-// SetPermissions sets up table ACL permissions
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/Set-Table-ACL
-func (t *Table) SetPermissions(tap []TableAccessPolicy, timeout uint, options *TableOptions) error {
- params := url.Values{"comp": {"acl"},
- "timeout": {strconv.Itoa(int(timeout))},
- }
-
- uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params)
- headers := t.tsc.client.getStandardHeaders()
- headers = options.addToHeaders(headers)
-
- body, length, err := generateTableACLPayload(tap)
- if err != nil {
- return err
- }
- headers["Content-Length"] = strconv.Itoa(length)
-
- resp, err := t.tsc.client.exec(http.MethodPut, uri, headers, body, t.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp)
-
- return checkRespCode(resp, []int{http.StatusNoContent})
-}
-
-func generateTableACLPayload(policies []TableAccessPolicy) (io.Reader, int, error) {
- sil := SignedIdentifiers{
- SignedIdentifiers: []SignedIdentifier{},
- }
- for _, tap := range policies {
- permission := generateTablePermissions(&tap)
- signedIdentifier := convertAccessPolicyToXMLStructs(tap.ID, tap.StartTime, tap.ExpiryTime, permission)
- sil.SignedIdentifiers = append(sil.SignedIdentifiers, signedIdentifier)
- }
- return xmlMarshal(sil)
-}
-
-// GetPermissions gets the table ACL permissions
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/get-table-acl
-func (t *Table) GetPermissions(timeout int, options *TableOptions) ([]TableAccessPolicy, error) {
- params := url.Values{"comp": {"acl"},
- "timeout": {strconv.Itoa(int(timeout))},
- }
-
- uri := t.tsc.client.getEndpoint(tableServiceName, t.Name, params)
- headers := t.tsc.client.getStandardHeaders()
- headers = options.addToHeaders(headers)
-
- resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
-
- var ap AccessPolicy
- err = xmlUnmarshal(resp.Body, &ap.SignedIdentifiersList)
- if err != nil {
- return nil, err
- }
- return updateTableAccessPolicy(ap), nil
-}
-
-func (t *Table) queryEntities(uri string, headers map[string]string, ml MetadataLevel) (*EntityQueryResult, error) {
- headers = mergeHeaders(headers, t.tsc.client.getStandardHeaders())
- if ml != EmptyPayload {
- headers[headerAccept] = string(ml)
- }
-
- resp, err := t.tsc.client.exec(http.MethodGet, uri, headers, nil, t.tsc.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if err = checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
-
- data, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
- var entities EntityQueryResult
- err = json.Unmarshal(data, &entities)
- if err != nil {
- return nil, err
- }
-
- for i := range entities.Entities {
- entities.Entities[i].Table = t
- }
- entities.table = t
-
- contToken := extractContinuationTokenFromHeaders(resp.Header)
- if contToken == nil {
- entities.NextLink = nil
- } else {
- originalURI, err := url.Parse(uri)
- if err != nil {
- return nil, err
- }
- v := originalURI.Query()
- if contToken.NextPartitionKey != "" {
- v.Set(nextPartitionKeyQueryParameter, contToken.NextPartitionKey)
- }
- if contToken.NextRowKey != "" {
- v.Set(nextRowKeyQueryParameter, contToken.NextRowKey)
- }
- newURI := t.tsc.client.getEndpoint(tableServiceName, t.buildPath(), v)
- entities.NextLink = &newURI
- entities.ml = ml
- }
-
- return &entities, nil
-}
-
-func extractContinuationTokenFromHeaders(h http.Header) *continuationToken {
- ct := continuationToken{
- NextPartitionKey: h.Get(headerNextPartitionKey),
- NextRowKey: h.Get(headerNextRowKey),
- }
-
- if ct.NextPartitionKey != "" || ct.NextRowKey != "" {
- return &ct
- }
- return nil
-}
-
-func updateTableAccessPolicy(ap AccessPolicy) []TableAccessPolicy {
- taps := []TableAccessPolicy{}
- for _, policy := range ap.SignedIdentifiersList.SignedIdentifiers {
- tap := TableAccessPolicy{
- ID: policy.ID,
- StartTime: policy.AccessPolicy.StartTime,
- ExpiryTime: policy.AccessPolicy.ExpiryTime,
- }
- tap.CanRead = updatePermissions(policy.AccessPolicy.Permission, "r")
- tap.CanAppend = updatePermissions(policy.AccessPolicy.Permission, "a")
- tap.CanUpdate = updatePermissions(policy.AccessPolicy.Permission, "u")
- tap.CanDelete = updatePermissions(policy.AccessPolicy.Permission, "d")
-
- taps = append(taps, tap)
- }
- return taps
-}
-
-func generateTablePermissions(tap *TableAccessPolicy) (permissions string) {
- // generate the permissions string (raud).
- // still want the end user API to have bool flags.
- permissions = ""
-
- if tap.CanRead {
- permissions += "r"
- }
-
- if tap.CanAppend {
- permissions += "a"
- }
-
- if tap.CanUpdate {
- permissions += "u"
- }
-
- if tap.CanDelete {
- permissions += "d"
- }
- return permissions
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go
deleted file mode 100644
index b5aaefe473..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/table_batch.go
+++ /dev/null
@@ -1,314 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "mime/multipart"
- "net/http"
- "net/textproto"
- "sort"
- "strings"
-)
-
-// Operation type. Insert, Delete, Replace etc.
-type Operation int
-
-// consts for batch operations.
-const (
- InsertOp = Operation(1)
- DeleteOp = Operation(2)
- ReplaceOp = Operation(3)
- MergeOp = Operation(4)
- InsertOrReplaceOp = Operation(5)
- InsertOrMergeOp = Operation(6)
-)
-
-// BatchEntity used for tracking Entities to operate on and
-// whether operations (replace/merge etc) should be forced.
-// Wrapper for regular Entity with additional data specific for the entity.
-type BatchEntity struct {
- *Entity
- Force bool
- Op Operation
-}
-
-// TableBatch stores all the entities that will be operated on during a batch process.
-// Entities can be inserted, replaced or deleted.
-type TableBatch struct {
- BatchEntitySlice []BatchEntity
-
- // reference to table we're operating on.
- Table *Table
-}
-
-// defaultChangesetHeaders for changeSets
-var defaultChangesetHeaders = map[string]string{
- "Accept": "application/json;odata=minimalmetadata",
- "Content-Type": "application/json",
- "Prefer": "return-no-content",
-}
-
-// NewBatch return new TableBatch for populating.
-func (t *Table) NewBatch() *TableBatch {
- return &TableBatch{
- Table: t,
- }
-}
-
-// InsertEntity adds an entity in preparation for a batch insert.
-func (t *TableBatch) InsertEntity(entity *Entity) {
- be := BatchEntity{Entity: entity, Force: false, Op: InsertOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// InsertOrReplaceEntity adds an entity in preparation for a batch insert or replace.
-func (t *TableBatch) InsertOrReplaceEntity(entity *Entity, force bool) {
- be := BatchEntity{Entity: entity, Force: false, Op: InsertOrReplaceOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// InsertOrReplaceEntityByForce adds an entity in preparation for a batch insert or replace. Forces regardless of ETag
-func (t *TableBatch) InsertOrReplaceEntityByForce(entity *Entity) {
- t.InsertOrReplaceEntity(entity, true)
-}
-
-// InsertOrMergeEntity adds an entity in preparation for a batch insert or merge.
-func (t *TableBatch) InsertOrMergeEntity(entity *Entity, force bool) {
- be := BatchEntity{Entity: entity, Force: false, Op: InsertOrMergeOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// InsertOrMergeEntityByForce adds an entity in preparation for a batch insert or merge. Forces regardless of ETag
-func (t *TableBatch) InsertOrMergeEntityByForce(entity *Entity) {
- t.InsertOrMergeEntity(entity, true)
-}
-
-// ReplaceEntity adds an entity in preparation for a batch replace.
-func (t *TableBatch) ReplaceEntity(entity *Entity) {
- be := BatchEntity{Entity: entity, Force: false, Op: ReplaceOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// DeleteEntity adds an entity in preparation for a batch delete
-func (t *TableBatch) DeleteEntity(entity *Entity, force bool) {
- be := BatchEntity{Entity: entity, Force: false, Op: DeleteOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// DeleteEntityByForce adds an entity in preparation for a batch delete. Forces regardless of ETag
-func (t *TableBatch) DeleteEntityByForce(entity *Entity, force bool) {
- t.DeleteEntity(entity, true)
-}
-
-// MergeEntity adds an entity in preparation for a batch merge
-func (t *TableBatch) MergeEntity(entity *Entity) {
- be := BatchEntity{Entity: entity, Force: false, Op: MergeOp}
- t.BatchEntitySlice = append(t.BatchEntitySlice, be)
-}
-
-// ExecuteBatch executes many table operations in one request to Azure.
-// The operations can be combinations of Insert, Delete, Replace and Merge
-// Creates the inner changeset body (various operations, Insert, Delete etc) then creates the outer request packet that encompasses
-// the changesets.
-// As per document https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/performing-entity-group-transactions
-func (t *TableBatch) ExecuteBatch() error {
-
- id, err := newUUID()
- if err != nil {
- return err
- }
-
- changesetBoundary := fmt.Sprintf("changeset_%s", id.String())
- uri := t.Table.tsc.client.getEndpoint(tableServiceName, "$batch", nil)
- changesetBody, err := t.generateChangesetBody(changesetBoundary)
- if err != nil {
- return err
- }
-
- id, err = newUUID()
- if err != nil {
- return err
- }
-
- boundary := fmt.Sprintf("batch_%s", id.String())
- body, err := generateBody(changesetBody, changesetBoundary, boundary)
- if err != nil {
- return err
- }
-
- headers := t.Table.tsc.client.getStandardHeaders()
- headers[headerContentType] = fmt.Sprintf("multipart/mixed; boundary=%s", boundary)
-
- resp, err := t.Table.tsc.client.execBatchOperationJSON(http.MethodPost, uri, headers, bytes.NewReader(body.Bytes()), t.Table.tsc.auth)
- if err != nil {
- return err
- }
- defer drainRespBody(resp.resp)
-
- if err = checkRespCode(resp.resp, []int{http.StatusAccepted}); err != nil {
-
- // check which batch failed.
- operationFailedMessage := t.getFailedOperation(resp.odata.Err.Message.Value)
- requestID, date, version := getDebugHeaders(resp.resp.Header)
- return AzureStorageServiceError{
- StatusCode: resp.resp.StatusCode,
- Code: resp.odata.Err.Code,
- RequestID: requestID,
- Date: date,
- APIVersion: version,
- Message: operationFailedMessage,
- }
- }
-
- return nil
-}
-
-// getFailedOperation parses the original Azure error string and determines which operation failed
-// and generates appropriate message.
-func (t *TableBatch) getFailedOperation(errorMessage string) string {
- // errorMessage consists of "number:string" we just need the number.
- sp := strings.Split(errorMessage, ":")
- if len(sp) > 1 {
- msg := fmt.Sprintf("Element %s in the batch returned an unexpected response code.\n%s", sp[0], errorMessage)
- return msg
- }
-
- // cant parse the message, just return the original message to client
- return errorMessage
-}
-
-// generateBody generates the complete body for the batch request.
-func generateBody(changeSetBody *bytes.Buffer, changesetBoundary string, boundary string) (*bytes.Buffer, error) {
-
- body := new(bytes.Buffer)
- writer := multipart.NewWriter(body)
- writer.SetBoundary(boundary)
- h := make(textproto.MIMEHeader)
- h.Set(headerContentType, fmt.Sprintf("multipart/mixed; boundary=%s\r\n", changesetBoundary))
- batchWriter, err := writer.CreatePart(h)
- if err != nil {
- return nil, err
- }
- batchWriter.Write(changeSetBody.Bytes())
- writer.Close()
- return body, nil
-}
-
-// generateChangesetBody generates the individual changesets for the various operations within the batch request.
-// There is a changeset for Insert, Delete, Merge etc.
-func (t *TableBatch) generateChangesetBody(changesetBoundary string) (*bytes.Buffer, error) {
-
- body := new(bytes.Buffer)
- writer := multipart.NewWriter(body)
- writer.SetBoundary(changesetBoundary)
-
- for _, be := range t.BatchEntitySlice {
- t.generateEntitySubset(&be, writer)
- }
-
- writer.Close()
- return body, nil
-}
-
-// generateVerb generates the HTTP request VERB required for each changeset.
-func generateVerb(op Operation) (string, error) {
- switch op {
- case InsertOp:
- return http.MethodPost, nil
- case DeleteOp:
- return http.MethodDelete, nil
- case ReplaceOp, InsertOrReplaceOp:
- return http.MethodPut, nil
- case MergeOp, InsertOrMergeOp:
- return "MERGE", nil
- default:
- return "", errors.New("Unable to detect operation")
- }
-}
-
-// generateQueryPath generates the query path for within the changesets
-// For inserts it will just be a table query path (table name)
-// but for other operations (modifying an existing entity) then
-// the partition/row keys need to be generated.
-func (t *TableBatch) generateQueryPath(op Operation, entity *Entity) string {
- if op == InsertOp {
- return entity.Table.buildPath()
- }
- return entity.buildPath()
-}
-
-// generateGenericOperationHeaders generates common headers for a given operation.
-func generateGenericOperationHeaders(be *BatchEntity) map[string]string {
- retval := map[string]string{}
-
- for k, v := range defaultChangesetHeaders {
- retval[k] = v
- }
-
- if be.Op == DeleteOp || be.Op == ReplaceOp || be.Op == MergeOp {
- if be.Force || be.Entity.OdataEtag == "" {
- retval["If-Match"] = "*"
- } else {
- retval["If-Match"] = be.Entity.OdataEtag
- }
- }
-
- return retval
-}
-
-// generateEntitySubset generates body payload for particular batch entity
-func (t *TableBatch) generateEntitySubset(batchEntity *BatchEntity, writer *multipart.Writer) error {
-
- h := make(textproto.MIMEHeader)
- h.Set(headerContentType, "application/http")
- h.Set(headerContentTransferEncoding, "binary")
-
- verb, err := generateVerb(batchEntity.Op)
- if err != nil {
- return err
- }
-
- genericOpHeadersMap := generateGenericOperationHeaders(batchEntity)
- queryPath := t.generateQueryPath(batchEntity.Op, batchEntity.Entity)
- uri := t.Table.tsc.client.getEndpoint(tableServiceName, queryPath, nil)
-
- operationWriter, err := writer.CreatePart(h)
- if err != nil {
- return err
- }
-
- urlAndVerb := fmt.Sprintf("%s %s HTTP/1.1\r\n", verb, uri)
- operationWriter.Write([]byte(urlAndVerb))
- writeHeaders(genericOpHeadersMap, &operationWriter)
- operationWriter.Write([]byte("\r\n")) // additional \r\n is needed per changeset separating the "headers" and the body.
-
- // delete operation doesn't need a body.
- if batchEntity.Op != DeleteOp {
- //var e Entity = batchEntity.Entity
- body, err := json.Marshal(batchEntity.Entity)
- if err != nil {
- return err
- }
- operationWriter.Write(body)
- }
-
- return nil
-}
-
-func writeHeaders(h map[string]string, writer *io.Writer) {
- // This way it is guaranteed the headers will be written in a sorted order
- var keys []string
- for k := range h {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- (*writer).Write([]byte(fmt.Sprintf("%s: %s\r\n", k, h[k])))
- }
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go
deleted file mode 100644
index 8eccd5927b..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/tableserviceclient.go
+++ /dev/null
@@ -1,193 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "net/url"
- "strconv"
-)
-
-const (
- headerAccept = "Accept"
- headerEtag = "Etag"
- headerPrefer = "Prefer"
- headerXmsContinuation = "x-ms-Continuation-NextTableName"
-)
-
-// TableServiceClient contains operations for Microsoft Azure Table Storage
-// Service.
-type TableServiceClient struct {
- client Client
- auth authentication
-}
-
-// TableOptions includes options for some table operations
-type TableOptions struct {
- RequestID string
-}
-
-func (options *TableOptions) addToHeaders(h map[string]string) map[string]string {
- if options != nil {
- h = addToHeaders(h, "x-ms-client-request-id", options.RequestID)
- }
- return h
-}
-
-// QueryNextLink includes information for getting the next page of
-// results in query operations
-type QueryNextLink struct {
- NextLink *string
- ml MetadataLevel
-}
-
-// GetServiceProperties gets the properties of your storage account's table service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/get-table-service-properties
-func (t *TableServiceClient) GetServiceProperties() (*ServiceProperties, error) {
- return t.client.getServiceProperties(tableServiceName, t.auth)
-}
-
-// SetServiceProperties sets the properties of your storage account's table service.
-// See: https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/set-table-service-properties
-func (t *TableServiceClient) SetServiceProperties(props ServiceProperties) error {
- return t.client.setServiceProperties(props, tableServiceName, t.auth)
-}
-
-// GetTableReference returns a Table object for the specified table name.
-func (t *TableServiceClient) GetTableReference(name string) *Table {
- return &Table{
- tsc: t,
- Name: name,
- }
-}
-
-// QueryTablesOptions includes options for some table operations
-type QueryTablesOptions struct {
- Top uint
- Filter string
- RequestID string
-}
-
-func (options *QueryTablesOptions) getParameters() (url.Values, map[string]string) {
- query := url.Values{}
- headers := map[string]string{}
- if options != nil {
- if options.Top > 0 {
- query.Add(OdataTop, strconv.FormatUint(uint64(options.Top), 10))
- }
- if options.Filter != "" {
- query.Add(OdataFilter, options.Filter)
- }
- headers = addToHeaders(headers, "x-ms-client-request-id", options.RequestID)
- }
- return query, headers
-}
-
-// QueryTables returns the tables in the storage account.
-// You can use query options defined by the OData Protocol specification.
-//
-// See https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/query-tables
-func (t *TableServiceClient) QueryTables(ml MetadataLevel, options *QueryTablesOptions) (*TableQueryResult, error) {
- query, headers := options.getParameters()
- uri := t.client.getEndpoint(tableServiceName, tablesURIPath, query)
- return t.queryTables(uri, headers, ml)
-}
-
-// NextResults returns the next page of results
-// from a QueryTables or a NextResults operation.
-//
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-tables
-// See https://docs.microsoft.com/rest/api/storageservices/fileservices/query-timeout-and-pagination
-func (tqr *TableQueryResult) NextResults(options *TableOptions) (*TableQueryResult, error) {
- if tqr == nil {
- return nil, errNilPreviousResult
- }
- if tqr.NextLink == nil {
- return nil, errNilNextLink
- }
- headers := options.addToHeaders(map[string]string{})
-
- return tqr.tsc.queryTables(*tqr.NextLink, headers, tqr.ml)
-}
-
-// TableQueryResult contains the response from
-// QueryTables and QueryTablesNextResults functions.
-type TableQueryResult struct {
- OdataMetadata string `json:"odata.metadata"`
- Tables []Table `json:"value"`
- QueryNextLink
- tsc *TableServiceClient
-}
-
-func (t *TableServiceClient) queryTables(uri string, headers map[string]string, ml MetadataLevel) (*TableQueryResult, error) {
- if ml == EmptyPayload {
- return nil, errEmptyPayload
- }
- headers = mergeHeaders(headers, t.client.getStandardHeaders())
- headers[headerAccept] = string(ml)
-
- resp, err := t.client.exec(http.MethodGet, uri, headers, nil, t.auth)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if err := checkRespCode(resp, []int{http.StatusOK}); err != nil {
- return nil, err
- }
-
- respBody, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- return nil, err
- }
- var out TableQueryResult
- err = json.Unmarshal(respBody, &out)
- if err != nil {
- return nil, err
- }
-
- for i := range out.Tables {
- out.Tables[i].tsc = t
- }
- out.tsc = t
-
- nextLink := resp.Header.Get(http.CanonicalHeaderKey(headerXmsContinuation))
- if nextLink == "" {
- out.NextLink = nil
- } else {
- originalURI, err := url.Parse(uri)
- if err != nil {
- return nil, err
- }
- v := originalURI.Query()
- v.Set(nextTableQueryParameter, nextLink)
- newURI := t.client.getEndpoint(tableServiceName, tablesURIPath, v)
- out.NextLink = &newURI
- out.ml = ml
- }
-
- return &out, nil
-}
-
-func addBodyRelatedHeaders(h map[string]string, length int) map[string]string {
- h[headerContentType] = "application/json"
- h[headerContentLength] = fmt.Sprintf("%v", length)
- h[headerAcceptCharset] = "UTF-8"
- return h
-}
-
-func addReturnContentHeaders(h map[string]string, ml MetadataLevel) map[string]string {
- if ml != EmptyPayload {
- h[headerPrefer] = "return-content"
- h[headerAccept] = string(ml)
- } else {
- h[headerPrefer] = "return-no-content"
- // From API version 2015-12-11 onwards, Accept header is required
- h[headerAccept] = string(NoMetadata)
- }
- return h
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go b/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go
deleted file mode 100644
index 47a871991d..0000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/storage/util.go
+++ /dev/null
@@ -1,249 +0,0 @@
-package storage
-
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See License.txt in the project root for license information.
-
-import (
- "bytes"
- "crypto/hmac"
- "crypto/rand"
- "crypto/sha256"
- "encoding/base64"
- "encoding/xml"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "reflect"
- "strconv"
- "strings"
- "time"
-
- "github.com/gofrs/uuid"
-)
-
-var (
- fixedTime = time.Date(2050, time.December, 20, 21, 55, 0, 0, time.FixedZone("GMT", -6))
- accountSASOptions = AccountSASTokenOptions{
- Services: Services{
- Blob: true,
- },
- ResourceTypes: ResourceTypes{
- Service: true,
- Container: true,
- Object: true,
- },
- Permissions: Permissions{
- Read: true,
- Write: true,
- Delete: true,
- List: true,
- Add: true,
- Create: true,
- Update: true,
- Process: true,
- },
- Expiry: fixedTime,
- UseHTTPS: true,
- }
-)
-
-func (c Client) computeHmac256(message string) string {
- h := hmac.New(sha256.New, c.accountKey)
- h.Write([]byte(message))
- return base64.StdEncoding.EncodeToString(h.Sum(nil))
-}
-
-func currentTimeRfc1123Formatted() string {
- return timeRfc1123Formatted(time.Now().UTC())
-}
-
-func timeRfc1123Formatted(t time.Time) string {
- return t.Format(http.TimeFormat)
-}
-
-func timeRFC3339Formatted(t time.Time) string {
- return t.Format("2006-01-02T15:04:05.0000000Z")
-}
-
-func mergeParams(v1, v2 url.Values) url.Values {
- out := url.Values{}
- for k, v := range v1 {
- out[k] = v
- }
- for k, v := range v2 {
- vals, ok := out[k]
- if ok {
- vals = append(vals, v...)
- out[k] = vals
- } else {
- out[k] = v
- }
- }
- return out
-}
-
-func prepareBlockListRequest(blocks []Block) string {
- s := ``
- for _, v := range blocks {
- s += fmt.Sprintf("<%s>%s%s>", v.Status, v.ID, v.Status)
- }
- s += ``
- return s
-}
-
-func xmlUnmarshal(body io.Reader, v interface{}) error {
- data, err := ioutil.ReadAll(body)
- if err != nil {
- return err
- }
- return xml.Unmarshal(data, v)
-}
-
-func xmlMarshal(v interface{}) (io.Reader, int, error) {
- b, err := xml.Marshal(v)
- if err != nil {
- return nil, 0, err
- }
- return bytes.NewReader(b), len(b), nil
-}
-
-func headersFromStruct(v interface{}) map[string]string {
- headers := make(map[string]string)
- value := reflect.ValueOf(v)
- for i := 0; i < value.NumField(); i++ {
- key := value.Type().Field(i).Tag.Get("header")
- if key != "" {
- reflectedValue := reflect.Indirect(value.Field(i))
- var val string
- if reflectedValue.IsValid() {
- switch reflectedValue.Type() {
- case reflect.TypeOf(fixedTime):
- val = timeRfc1123Formatted(reflectedValue.Interface().(time.Time))
- case reflect.TypeOf(uint64(0)), reflect.TypeOf(uint(0)):
- val = strconv.FormatUint(reflectedValue.Uint(), 10)
- case reflect.TypeOf(int(0)):
- val = strconv.FormatInt(reflectedValue.Int(), 10)
- default:
- val = reflectedValue.String()
- }
- }
- if val != "" {
- headers[key] = val
- }
- }
- }
- return headers
-}
-
-// merges extraHeaders into headers and returns headers
-func mergeHeaders(headers, extraHeaders map[string]string) map[string]string {
- for k, v := range extraHeaders {
- headers[k] = v
- }
- return headers
-}
-
-func addToHeaders(h map[string]string, key, value string) map[string]string {
- if value != "" {
- h[key] = value
- }
- return h
-}
-
-func addTimeToHeaders(h map[string]string, key string, value *time.Time) map[string]string {
- if value != nil {
- h = addToHeaders(h, key, timeRfc1123Formatted(*value))
- }
- return h
-}
-
-func addTimeout(params url.Values, timeout uint) url.Values {
- if timeout > 0 {
- params.Add("timeout", fmt.Sprintf("%v", timeout))
- }
- return params
-}
-
-func addSnapshot(params url.Values, snapshot *time.Time) url.Values {
- if snapshot != nil {
- params.Add("snapshot", timeRFC3339Formatted(*snapshot))
- }
- return params
-}
-
-func getTimeFromHeaders(h http.Header, key string) (*time.Time, error) {
- var out time.Time
- var err error
- outStr := h.Get(key)
- if outStr != "" {
- out, err = time.Parse(time.RFC1123, outStr)
- if err != nil {
- return nil, err
- }
- }
- return &out, nil
-}
-
-// TimeRFC1123 is an alias for time.Time needed for custom Unmarshalling
-type TimeRFC1123 time.Time
-
-// UnmarshalXML is a custom unmarshaller that overrides the default time unmarshal which uses a different time layout.
-func (t *TimeRFC1123) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
- var value string
- d.DecodeElement(&value, &start)
- parse, err := time.Parse(time.RFC1123, value)
- if err != nil {
- return err
- }
- *t = TimeRFC1123(parse)
- return nil
-}
-
-// MarshalXML marshals using time.RFC1123.
-func (t *TimeRFC1123) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
- return e.EncodeElement(time.Time(*t).Format(time.RFC1123), start)
-}
-
-// returns a map of custom metadata values from the specified HTTP header
-func getMetadataFromHeaders(header http.Header) map[string]string {
- metadata := make(map[string]string)
- for k, v := range header {
- // Can't trust CanonicalHeaderKey() to munge case
- // reliably. "_" is allowed in identifiers:
- // https://msdn.microsoft.com/en-us/library/azure/dd179414.aspx
- // https://msdn.microsoft.com/library/aa664670(VS.71).aspx
- // http://tools.ietf.org/html/rfc7230#section-3.2
- // ...but "_" is considered invalid by
- // CanonicalMIMEHeaderKey in
- // https://golang.org/src/net/textproto/reader.go?s=14615:14659#L542
- // so k can be "X-Ms-Meta-Lol" or "x-ms-meta-lol_rofl".
- k = strings.ToLower(k)
- if len(v) == 0 || !strings.HasPrefix(k, strings.ToLower(userDefinedMetadataHeaderPrefix)) {
- continue
- }
- // metadata["lol"] = content of the last X-Ms-Meta-Lol header
- k = k[len(userDefinedMetadataHeaderPrefix):]
- metadata[k] = v[len(v)-1]
- }
-
- if len(metadata) == 0 {
- return nil
- }
-
- return metadata
-}
-
-// newUUID returns a new uuid using RFC 4122 algorithm.
-func newUUID() (uuid.UUID, error) {
- u := [16]byte{}
- // Set all bits to randomly (or pseudo-randomly) chosen values.
- _, err := rand.Read(u[:])
- if err != nil {
- return uuid.UUID{}, err
- }
- u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) // u.setVariant(ReservedRFC4122)
- u[6] = (u[6] & 0xF) | (uuid.V4 << 4) // u.setVersion(V4)
- return uuid.FromBytes(u[:])
-}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/go.mod b/vendor/github.com/Azure/go-autorest/autorest/go.mod
index 383d10290f..9f518c11d7 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/go.mod
+++ b/vendor/github.com/Azure/go-autorest/autorest/go.mod
@@ -8,5 +8,5 @@ require (
github.com/Azure/go-autorest/autorest/mocks v0.4.1
github.com/Azure/go-autorest/logger v0.2.1
github.com/Azure/go-autorest/tracing v0.6.0
- golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0
+ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
)
diff --git a/vendor/github.com/Azure/go-autorest/autorest/go.sum b/vendor/github.com/Azure/go-autorest/autorest/go.sum
index 0431571b33..8728b1fc65 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/go.sum
+++ b/vendor/github.com/Azure/go-autorest/autorest/go.sum
@@ -13,9 +13,16 @@ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBp
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
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/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
diff --git a/vendor/github.com/gofrs/uuid/.gitignore b/vendor/github.com/gofrs/uuid/.gitignore
deleted file mode 100644
index 666dbbb5bc..0000000000
--- a/vendor/github.com/gofrs/uuid/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-
-# Test binary, build with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
-# binary bundle generated by go-fuzz
-uuid-fuzz.zip
diff --git a/vendor/github.com/gofrs/uuid/.travis.yml b/vendor/github.com/gofrs/uuid/.travis.yml
deleted file mode 100644
index 0783aaa9c4..0000000000
--- a/vendor/github.com/gofrs/uuid/.travis.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-language: go
-sudo: false
-go:
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - 1.10.x
- - 1.11.x
- - 1.12.x
- - tip
-matrix:
- allow_failures:
- - go: tip
- fast_finish: true
-before_install:
- - go get golang.org/x/tools/cmd/cover
-script:
- - go test ./... -race -coverprofile=coverage.txt -covermode=atomic
-after_success:
- - bash <(curl -s https://codecov.io/bash)
-notifications:
- email: false
diff --git a/vendor/github.com/gofrs/uuid/LICENSE b/vendor/github.com/gofrs/uuid/LICENSE
deleted file mode 100644
index 926d549870..0000000000
--- a/vendor/github.com/gofrs/uuid/LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (C) 2013-2018 by Maxim Bublis
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/gofrs/uuid/README.md b/vendor/github.com/gofrs/uuid/README.md
deleted file mode 100644
index 2685a832e3..0000000000
--- a/vendor/github.com/gofrs/uuid/README.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# UUID
-
-[![License](https://img.shields.io/github/license/gofrs/uuid.svg)](https://github.com/gofrs/uuid/blob/master/LICENSE)
-[![Build Status](https://travis-ci.org/gofrs/uuid.svg?branch=master)](https://travis-ci.org/gofrs/uuid)
-[![GoDoc](http://godoc.org/github.com/gofrs/uuid?status.svg)](http://godoc.org/github.com/gofrs/uuid)
-[![Coverage Status](https://codecov.io/gh/gofrs/uuid/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/gh/gofrs/uuid/)
-[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/uuid)](https://goreportcard.com/report/github.com/gofrs/uuid)
-
-Package uuid provides a pure Go implementation of Universally Unique Identifiers
-(UUID) variant as defined in RFC-4122. This package supports both the creation
-and parsing of UUIDs in different formats.
-
-This package supports the following UUID versions:
-* Version 1, based on timestamp and MAC address (RFC-4122)
-* Version 3, based on MD5 hashing of a named value (RFC-4122)
-* Version 4, based on random numbers (RFC-4122)
-* Version 5, based on SHA-1 hashing of a named value (RFC-4122)
-
-## Project History
-
-This project was originally forked from the
-[github.com/satori/go.uuid](https://github.com/satori/go.uuid) repository after
-it appeared to be no longer maintained, while exhibiting [critical
-flaws](https://github.com/satori/go.uuid/issues/73). We have decided to take
-over this project to ensure it receives regular maintenance for the benefit of
-the larger Go community.
-
-We'd like to thank Maxim Bublis for his hard work on the original iteration of
-the package.
-
-## License
-
-This source code of this package is released under the MIT License. Please see
-the [LICENSE](https://github.com/gofrs/uuid/blob/master/LICENSE) for the full
-content of the license.
-
-## Recommended Package Version
-
-We recommend using v2.0.0+ of this package, as versions prior to 2.0.0 were
-created before our fork of the original package and have some known
-deficiencies.
-
-## Installation
-
-It is recommended to use a package manager like `dep` that understands tagged
-releases of a package, as well as semantic versioning.
-
-If you are unable to make use of a dependency manager with your project, you can
-use the `go get` command to download it directly:
-
-```Shell
-$ go get github.com/gofrs/uuid
-```
-
-## Requirements
-
-Due to subtests not being supported in older versions of Go, this package is
-only regularly tested against Go 1.7+. This package may work perfectly fine with
-Go 1.2+, but support for these older versions is not actively maintained.
-
-## Go 1.11 Modules
-
-As of v3.2.0, this repository no longer adopts Go modules, and v3.2.0 no longer has a `go.mod` file. As a result, v3.2.0 also drops support for the `github.com/gofrs/uuid/v3` import path. Only module-based consumers are impacted. With the v3.2.0 release, _all_ gofrs/uuid consumers should use the `github.com/gofrs/uuid` import path.
-
-An existing module-based consumer will continue to be able to build using the `github.com/gofrs/uuid/v3` import path using any valid consumer `go.mod` that worked prior to the publishing of v3.2.0, but any module-based consumer should start using the `github.com/gofrs/uuid` import path when possible and _must_ use the `github.com/gofrs/uuid` import path prior to upgrading to v3.2.0.
-
-Please refer to [Issue #61](https://github.com/gofrs/uuid/issues/61) and [Issue #66](https://github.com/gofrs/uuid/issues/66) for more details.
-
-## Usage
-
-Here is a quick overview of how to use this package. For more detailed
-documentation, please see the [GoDoc Page](http://godoc.org/github.com/gofrs/uuid).
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/gofrs/uuid"
-)
-
-// Create a Version 4 UUID, panicking on error.
-// Use this form to initialize package-level variables.
-var u1 = uuid.Must(uuid.NewV4())
-
-func main() {
- // Create a Version 4 UUID.
- u2, err := uuid.NewV4()
- if err != nil {
- log.Fatalf("failed to generate UUID: %v", err)
- }
- log.Printf("generated Version 4 UUID %v", u2)
-
- // Parse a UUID from a string.
- s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
- u3, err := uuid.FromString(s)
- if err != nil {
- log.Fatalf("failed to parse UUID %q: %v", s, err)
- }
- log.Printf("successfully parsed UUID %v", u3)
-}
-```
-
-## References
-
-* [RFC-4122](https://tools.ietf.org/html/rfc4122)
-* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01)
diff --git a/vendor/github.com/gofrs/uuid/codec.go b/vendor/github.com/gofrs/uuid/codec.go
deleted file mode 100644
index e3014c68c6..0000000000
--- a/vendor/github.com/gofrs/uuid/codec.go
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2013-2018 by Maxim Bublis
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-package uuid
-
-import (
- "bytes"
- "encoding/hex"
- "fmt"
-)
-
-// FromBytes returns a UUID generated from the raw byte slice input.
-// It will return an error if the slice isn't 16 bytes long.
-func FromBytes(input []byte) (UUID, error) {
- u := UUID{}
- err := u.UnmarshalBinary(input)
- return u, err
-}
-
-// FromBytesOrNil returns a UUID generated from the raw byte slice input.
-// Same behavior as FromBytes(), but returns uuid.Nil instead of an error.
-func FromBytesOrNil(input []byte) UUID {
- uuid, err := FromBytes(input)
- if err != nil {
- return Nil
- }
- return uuid
-}
-
-// FromString returns a UUID parsed from the input string.
-// Input is expected in a form accepted by UnmarshalText.
-func FromString(input string) (UUID, error) {
- u := UUID{}
- err := u.UnmarshalText([]byte(input))
- return u, err
-}
-
-// FromStringOrNil returns a UUID parsed from the input string.
-// Same behavior as FromString(), but returns uuid.Nil instead of an error.
-func FromStringOrNil(input string) UUID {
- uuid, err := FromString(input)
- if err != nil {
- return Nil
- }
- return uuid
-}
-
-// MarshalText implements the encoding.TextMarshaler interface.
-// The encoding is the same as returned by the String() method.
-func (u UUID) MarshalText() ([]byte, error) {
- return []byte(u.String()), nil
-}
-
-// UnmarshalText implements the encoding.TextUnmarshaler interface.
-// Following formats are supported:
-//
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
-// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}",
-// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
-// "6ba7b8109dad11d180b400c04fd430c8"
-// "{6ba7b8109dad11d180b400c04fd430c8}",
-// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8"
-//
-// ABNF for supported UUID text representation follows:
-//
-// URN := 'urn'
-// UUID-NID := 'uuid'
-//
-// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' |
-// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' |
-// 'A' | 'B' | 'C' | 'D' | 'E' | 'F'
-//
-// hexoct := hexdig hexdig
-// 2hexoct := hexoct hexoct
-// 4hexoct := 2hexoct 2hexoct
-// 6hexoct := 4hexoct 2hexoct
-// 12hexoct := 6hexoct 6hexoct
-//
-// hashlike := 12hexoct
-// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct
-//
-// plain := canonical | hashlike
-// uuid := canonical | hashlike | braced | urn
-//
-// braced := '{' plain '}' | '{' hashlike '}'
-// urn := URN ':' UUID-NID ':' plain
-//
-func (u *UUID) UnmarshalText(text []byte) error {
- switch len(text) {
- case 32:
- return u.decodeHashLike(text)
- case 34, 38:
- return u.decodeBraced(text)
- case 36:
- return u.decodeCanonical(text)
- case 41, 45:
- return u.decodeURN(text)
- default:
- return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(text), text)
- }
-}
-
-// decodeCanonical decodes UUID strings that are formatted as defined in RFC-4122 (section 3):
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8".
-func (u *UUID) decodeCanonical(t []byte) error {
- if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
- }
-
- src := t
- dst := u[:]
-
- for i, byteGroup := range byteGroups {
- if i > 0 {
- src = src[1:] // skip dash
- }
- _, err := hex.Decode(dst[:byteGroup/2], src[:byteGroup])
- if err != nil {
- return err
- }
- src = src[byteGroup:]
- dst = dst[byteGroup/2:]
- }
-
- return nil
-}
-
-// decodeHashLike decodes UUID strings that are using the following format:
-// "6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodeHashLike(t []byte) error {
- src := t[:]
- dst := u[:]
-
- _, err := hex.Decode(dst, src)
- return err
-}
-
-// decodeBraced decodes UUID strings that are using the following formats:
-// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}"
-// "{6ba7b8109dad11d180b400c04fd430c8}".
-func (u *UUID) decodeBraced(t []byte) error {
- l := len(t)
-
- if t[0] != '{' || t[l-1] != '}' {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
- }
-
- return u.decodePlain(t[1 : l-1])
-}
-
-// decodeURN decodes UUID strings that are using the following formats:
-// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8"
-// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodeURN(t []byte) error {
- total := len(t)
-
- urnUUIDPrefix := t[:9]
-
- if !bytes.Equal(urnUUIDPrefix, urnPrefix) {
- return fmt.Errorf("uuid: incorrect UUID format in string %q", t)
- }
-
- return u.decodePlain(t[9:total])
-}
-
-// decodePlain decodes UUID strings that are using the following formats:
-// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format
-// "6ba7b8109dad11d180b400c04fd430c8".
-func (u *UUID) decodePlain(t []byte) error {
- switch len(t) {
- case 32:
- return u.decodeHashLike(t)
- case 36:
- return u.decodeCanonical(t)
- default:
- return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(t), t)
- }
-}
-
-// MarshalBinary implements the encoding.BinaryMarshaler interface.
-func (u UUID) MarshalBinary() ([]byte, error) {
- return u.Bytes(), nil
-}
-
-// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface.
-// It will return an error if the slice isn't 16 bytes long.
-func (u *UUID) UnmarshalBinary(data []byte) error {
- if len(data) != Size {
- return fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data))
- }
- copy(u[:], data)
-
- return nil
-}
diff --git a/vendor/github.com/gofrs/uuid/fuzz.go b/vendor/github.com/gofrs/uuid/fuzz.go
deleted file mode 100644
index afaefbc8e3..0000000000
--- a/vendor/github.com/gofrs/uuid/fuzz.go
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2018 Andrei Tudor Călin
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// +build gofuzz
-
-package uuid
-
-// Fuzz implements a simple fuzz test for FromString / UnmarshalText.
-//
-// To run:
-//
-// $ go get github.com/dvyukov/go-fuzz/...
-// $ cd $GOPATH/src/github.com/gofrs/uuid
-// $ go-fuzz-build github.com/gofrs/uuid
-// $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata
-//
-// If you make significant changes to FromString / UnmarshalText and add
-// new cases to fromStringTests (in codec_test.go), please run
-//
-// $ go test -seed_fuzz_corpus
-//
-// to seed the corpus with the new interesting inputs, then run the fuzzer.
-func Fuzz(data []byte) int {
- _, err := FromString(string(data))
- if err != nil {
- return 0
- }
- return 1
-}
diff --git a/vendor/github.com/gofrs/uuid/generator.go b/vendor/github.com/gofrs/uuid/generator.go
deleted file mode 100644
index 2783d9e778..0000000000
--- a/vendor/github.com/gofrs/uuid/generator.go
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright (C) 2013-2018 by Maxim Bublis
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-package uuid
-
-import (
- "crypto/md5"
- "crypto/rand"
- "crypto/sha1"
- "encoding/binary"
- "fmt"
- "hash"
- "io"
- "net"
- "sync"
- "time"
-)
-
-// Difference in 100-nanosecond intervals between
-// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970).
-const epochStart = 122192928000000000
-
-type epochFunc func() time.Time
-
-// HWAddrFunc is the function type used to provide hardware (MAC) addresses.
-type HWAddrFunc func() (net.HardwareAddr, error)
-
-// DefaultGenerator is the default UUID Generator used by this package.
-var DefaultGenerator Generator = NewGen()
-
-// NewV1 returns a UUID based on the current timestamp and MAC address.
-func NewV1() (UUID, error) {
- return DefaultGenerator.NewV1()
-}
-
-// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name.
-func NewV3(ns UUID, name string) UUID {
- return DefaultGenerator.NewV3(ns, name)
-}
-
-// NewV4 returns a randomly generated UUID.
-func NewV4() (UUID, error) {
- return DefaultGenerator.NewV4()
-}
-
-// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name.
-func NewV5(ns UUID, name string) UUID {
- return DefaultGenerator.NewV5(ns, name)
-}
-
-// Generator provides an interface for generating UUIDs.
-type Generator interface {
- NewV1() (UUID, error)
- NewV3(ns UUID, name string) UUID
- NewV4() (UUID, error)
- NewV5(ns UUID, name string) UUID
-}
-
-// Gen is a reference UUID generator based on the specifications laid out in
-// RFC-4122 and DCE 1.1: Authentication and Security Services. This type
-// satisfies the Generator interface as defined in this package.
-//
-// For consumers who are generating V1 UUIDs, but don't want to expose the MAC
-// address of the node generating the UUIDs, the NewGenWithHWAF() function has been
-// provided as a convenience. See the function's documentation for more info.
-//
-// The authors of this package do not feel that the majority of users will need
-// to obfuscate their MAC address, and so we recommend using NewGen() to create
-// a new generator.
-type Gen struct {
- clockSequenceOnce sync.Once
- hardwareAddrOnce sync.Once
- storageMutex sync.Mutex
-
- rand io.Reader
-
- epochFunc epochFunc
- hwAddrFunc HWAddrFunc
- lastTime uint64
- clockSequence uint16
- hardwareAddr [6]byte
-}
-
-// interface check -- build will fail if *Gen doesn't satisfy Generator
-var _ Generator = (*Gen)(nil)
-
-// NewGen returns a new instance of Gen with some default values set. Most
-// people should use this.
-func NewGen() *Gen {
- return NewGenWithHWAF(defaultHWAddrFunc)
-}
-
-// NewGenWithHWAF builds a new UUID generator with the HWAddrFunc provided. Most
-// consumers should use NewGen() instead.
-//
-// This is used so that consumers can generate their own MAC addresses, for use
-// in the generated UUIDs, if there is some concern about exposing the physical
-// address of the machine generating the UUID.
-//
-// The Gen generator will only invoke the HWAddrFunc once, and cache that MAC
-// address for all the future UUIDs generated by it. If you'd like to switch the
-// MAC address being used, you'll need to create a new generator using this
-// function.
-func NewGenWithHWAF(hwaf HWAddrFunc) *Gen {
- return &Gen{
- epochFunc: time.Now,
- hwAddrFunc: hwaf,
- rand: rand.Reader,
- }
-}
-
-// NewV1 returns a UUID based on the current timestamp and MAC address.
-func (g *Gen) NewV1() (UUID, error) {
- u := UUID{}
-
- timeNow, clockSeq, err := g.getClockSequence()
- if err != nil {
- return Nil, err
- }
- binary.BigEndian.PutUint32(u[0:], uint32(timeNow))
- binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32))
- binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48))
- binary.BigEndian.PutUint16(u[8:], clockSeq)
-
- hardwareAddr, err := g.getHardwareAddr()
- if err != nil {
- return Nil, err
- }
- copy(u[10:], hardwareAddr)
-
- u.SetVersion(V1)
- u.SetVariant(VariantRFC4122)
-
- return u, nil
-}
-
-// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name.
-func (g *Gen) NewV3(ns UUID, name string) UUID {
- u := newFromHash(md5.New(), ns, name)
- u.SetVersion(V3)
- u.SetVariant(VariantRFC4122)
-
- return u
-}
-
-// NewV4 returns a randomly generated UUID.
-func (g *Gen) NewV4() (UUID, error) {
- u := UUID{}
- if _, err := io.ReadFull(g.rand, u[:]); err != nil {
- return Nil, err
- }
- u.SetVersion(V4)
- u.SetVariant(VariantRFC4122)
-
- return u, nil
-}
-
-// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name.
-func (g *Gen) NewV5(ns UUID, name string) UUID {
- u := newFromHash(sha1.New(), ns, name)
- u.SetVersion(V5)
- u.SetVariant(VariantRFC4122)
-
- return u
-}
-
-// getClockSequence returns the epoch and clock sequence.
-func (g *Gen) getClockSequence() (uint64, uint16, error) {
- var err error
- g.clockSequenceOnce.Do(func() {
- buf := make([]byte, 2)
- if _, err = io.ReadFull(g.rand, buf); err != nil {
- return
- }
- g.clockSequence = binary.BigEndian.Uint16(buf)
- })
- if err != nil {
- return 0, 0, err
- }
-
- g.storageMutex.Lock()
- defer g.storageMutex.Unlock()
-
- timeNow := g.getEpoch()
- // Clock didn't change since last UUID generation.
- // Should increase clock sequence.
- if timeNow <= g.lastTime {
- g.clockSequence++
- }
- g.lastTime = timeNow
-
- return timeNow, g.clockSequence, nil
-}
-
-// Returns the hardware address.
-func (g *Gen) getHardwareAddr() ([]byte, error) {
- var err error
- g.hardwareAddrOnce.Do(func() {
- var hwAddr net.HardwareAddr
- if hwAddr, err = g.hwAddrFunc(); err == nil {
- copy(g.hardwareAddr[:], hwAddr)
- return
- }
-
- // Initialize hardwareAddr randomly in case
- // of real network interfaces absence.
- if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil {
- return
- }
- // Set multicast bit as recommended by RFC-4122
- g.hardwareAddr[0] |= 0x01
- })
- if err != nil {
- return []byte{}, err
- }
- return g.hardwareAddr[:], nil
-}
-
-// Returns the difference between UUID epoch (October 15, 1582)
-// and current time in 100-nanosecond intervals.
-func (g *Gen) getEpoch() uint64 {
- return epochStart + uint64(g.epochFunc().UnixNano()/100)
-}
-
-// Returns the UUID based on the hashing of the namespace UUID and name.
-func newFromHash(h hash.Hash, ns UUID, name string) UUID {
- u := UUID{}
- h.Write(ns[:])
- h.Write([]byte(name))
- copy(u[:], h.Sum(nil))
-
- return u
-}
-
-// Returns the hardware address.
-func defaultHWAddrFunc() (net.HardwareAddr, error) {
- ifaces, err := net.Interfaces()
- if err != nil {
- return []byte{}, err
- }
- for _, iface := range ifaces {
- if len(iface.HardwareAddr) >= 6 {
- return iface.HardwareAddr, nil
- }
- }
- return []byte{}, fmt.Errorf("uuid: no HW address found")
-}
diff --git a/vendor/github.com/gofrs/uuid/sql.go b/vendor/github.com/gofrs/uuid/sql.go
deleted file mode 100644
index 6f254a4fd1..0000000000
--- a/vendor/github.com/gofrs/uuid/sql.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright (C) 2013-2018 by Maxim Bublis
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-package uuid
-
-import (
- "bytes"
- "database/sql/driver"
- "encoding/json"
- "fmt"
-)
-
-// Value implements the driver.Valuer interface.
-func (u UUID) Value() (driver.Value, error) {
- return u.String(), nil
-}
-
-// Scan implements the sql.Scanner interface.
-// A 16-byte slice will be handled by UnmarshalBinary, while
-// a longer byte slice or a string will be handled by UnmarshalText.
-func (u *UUID) Scan(src interface{}) error {
- switch src := src.(type) {
- case UUID: // support gorm convert from UUID to NullUUID
- *u = src
- return nil
-
- case []byte:
- if len(src) == Size {
- return u.UnmarshalBinary(src)
- }
- return u.UnmarshalText(src)
-
- case string:
- return u.UnmarshalText([]byte(src))
- }
-
- return fmt.Errorf("uuid: cannot convert %T to UUID", src)
-}
-
-// NullUUID can be used with the standard sql package to represent a
-// UUID value that can be NULL in the database.
-type NullUUID struct {
- UUID UUID
- Valid bool
-}
-
-// Value implements the driver.Valuer interface.
-func (u NullUUID) Value() (driver.Value, error) {
- if !u.Valid {
- return nil, nil
- }
- // Delegate to UUID Value function
- return u.UUID.Value()
-}
-
-// Scan implements the sql.Scanner interface.
-func (u *NullUUID) Scan(src interface{}) error {
- if src == nil {
- u.UUID, u.Valid = Nil, false
- return nil
- }
-
- // Delegate to UUID Scan function
- u.Valid = true
- return u.UUID.Scan(src)
-}
-
-// MarshalJSON marshals the NullUUID as null or the nested UUID
-func (u NullUUID) MarshalJSON() ([]byte, error) {
- if !u.Valid {
- return json.Marshal(nil)
- }
-
- return json.Marshal(u.UUID)
-}
-
-// UnmarshalJSON unmarshals a NullUUID
-func (u *NullUUID) UnmarshalJSON(b []byte) error {
- if bytes.Equal(b, []byte("null")) {
- u.UUID, u.Valid = Nil, false
- return nil
- }
-
- if err := json.Unmarshal(b, &u.UUID); err != nil {
- return err
- }
-
- u.Valid = true
-
- return nil
-}
diff --git a/vendor/github.com/gofrs/uuid/uuid.go b/vendor/github.com/gofrs/uuid/uuid.go
deleted file mode 100644
index 78aed6e253..0000000000
--- a/vendor/github.com/gofrs/uuid/uuid.go
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (C) 2013-2018 by Maxim Bublis
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-// Package uuid provides implementations of the Universally Unique Identifier
-// (UUID), as specified in RFC-4122,
-//
-// RFC-4122[1] provides the specification for versions 1, 3, 4, and 5.
-//
-// DCE 1.1[2] provides the specification for version 2, but version 2 support
-// was removed from this package in v4 due to some concerns with the
-// specification itself. Reading the spec, it seems that it would result in
-// generating UUIDs that aren't very unique. In having read the spec it seemed
-// that our implementation did not meet the spec. It also seems to be at-odds
-// with RFC 4122, meaning we would need quite a bit of special code to support
-// it. Lastly, there were no Version 2 implementations that we could find to
-// ensure we were understanding the specification correctly.
-//
-// [1] https://tools.ietf.org/html/rfc4122
-// [2] http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01
-package uuid
-
-import (
- "encoding/binary"
- "encoding/hex"
- "fmt"
- "io"
- "strings"
- "time"
-)
-
-// Size of a UUID in bytes.
-const Size = 16
-
-// UUID is an array type to represent the value of a UUID, as defined in RFC-4122.
-type UUID [Size]byte
-
-// UUID versions.
-const (
- _ byte = iota
- V1 // Version 1 (date-time and MAC address)
- _ // Version 2 (date-time and MAC address, DCE security version) [removed]
- V3 // Version 3 (namespace name-based)
- V4 // Version 4 (random)
- V5 // Version 5 (namespace name-based)
-)
-
-// UUID layout variants.
-const (
- VariantNCS byte = iota
- VariantRFC4122
- VariantMicrosoft
- VariantFuture
-)
-
-// UUID DCE domains.
-const (
- DomainPerson = iota
- DomainGroup
- DomainOrg
-)
-
-// Timestamp is the count of 100-nanosecond intervals since 00:00:00.00,
-// 15 October 1582 within a V1 UUID. This type has no meaning for other
-// UUID versions since they don't have an embedded timestamp.
-type Timestamp uint64
-
-const _100nsPerSecond = 10000000
-
-// Time returns the UTC time.Time representation of a Timestamp
-func (t Timestamp) Time() (time.Time, error) {
- secs := uint64(t) / _100nsPerSecond
- nsecs := 100 * (uint64(t) % _100nsPerSecond)
- return time.Unix(int64(secs)-(epochStart/_100nsPerSecond), int64(nsecs)), nil
-}
-
-// TimestampFromV1 returns the Timestamp embedded within a V1 UUID.
-// Returns an error if the UUID is any version other than 1.
-func TimestampFromV1(u UUID) (Timestamp, error) {
- if u.Version() != 1 {
- err := fmt.Errorf("uuid: %s is version %d, not version 1", u, u.Version())
- return 0, err
- }
- low := binary.BigEndian.Uint32(u[0:4])
- mid := binary.BigEndian.Uint16(u[4:6])
- hi := binary.BigEndian.Uint16(u[6:8]) & 0xfff
- return Timestamp(uint64(low) + (uint64(mid) << 32) + (uint64(hi) << 48)), nil
-}
-
-// String parse helpers.
-var (
- urnPrefix = []byte("urn:uuid:")
- byteGroups = []int{8, 4, 4, 4, 12}
-)
-
-// Nil is the nil UUID, as specified in RFC-4122, that has all 128 bits set to
-// zero.
-var Nil = UUID{}
-
-// Predefined namespace UUIDs.
-var (
- NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
- NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8"))
- NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8"))
- NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8"))
-)
-
-// Version returns the algorithm version used to generate the UUID.
-func (u UUID) Version() byte {
- return u[6] >> 4
-}
-
-// Variant returns the UUID layout variant.
-func (u UUID) Variant() byte {
- switch {
- case (u[8] >> 7) == 0x00:
- return VariantNCS
- case (u[8] >> 6) == 0x02:
- return VariantRFC4122
- case (u[8] >> 5) == 0x06:
- return VariantMicrosoft
- case (u[8] >> 5) == 0x07:
- fallthrough
- default:
- return VariantFuture
- }
-}
-
-// Bytes returns a byte slice representation of the UUID.
-func (u UUID) Bytes() []byte {
- return u[:]
-}
-
-// String returns a canonical RFC-4122 string representation of the UUID:
-// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
-func (u UUID) String() string {
- buf := make([]byte, 36)
-
- hex.Encode(buf[0:8], u[0:4])
- buf[8] = '-'
- hex.Encode(buf[9:13], u[4:6])
- buf[13] = '-'
- hex.Encode(buf[14:18], u[6:8])
- buf[18] = '-'
- hex.Encode(buf[19:23], u[8:10])
- buf[23] = '-'
- hex.Encode(buf[24:], u[10:])
-
- return string(buf)
-}
-
-// Format implements fmt.Formatter for UUID values.
-//
-// The behavior is as follows:
-// The 'x' and 'X' verbs output only the hex digits of the UUID, using a-f for 'x' and A-F for 'X'.
-// The 'v', '+v', 's' and 'q' verbs return the canonical RFC-4122 string representation.
-// The 'S' verb returns the RFC-4122 format, but with capital hex digits.
-// The '#v' verb returns the "Go syntax" representation, which is a 16 byte array initializer.
-// All other verbs not handled directly by the fmt package (like '%p') are unsupported and will return
-// "%!verb(uuid.UUID=value)" as recommended by the fmt package.
-func (u UUID) Format(f fmt.State, c rune) {
- switch c {
- case 'x', 'X':
- s := hex.EncodeToString(u.Bytes())
- if c == 'X' {
- s = strings.Map(toCapitalHexDigits, s)
- }
- _, _ = io.WriteString(f, s)
- case 'v':
- var s string
- if f.Flag('#') {
- s = fmt.Sprintf("%#v", [Size]byte(u))
- } else {
- s = u.String()
- }
- _, _ = io.WriteString(f, s)
- case 's', 'S':
- s := u.String()
- if c == 'S' {
- s = strings.Map(toCapitalHexDigits, s)
- }
- _, _ = io.WriteString(f, s)
- case 'q':
- _, _ = io.WriteString(f, `"`+u.String()+`"`)
- default:
- // invalid/unsupported format verb
- fmt.Fprintf(f, "%%!%c(uuid.UUID=%s)", c, u.String())
- }
-}
-
-func toCapitalHexDigits(ch rune) rune {
- // convert a-f hex digits to A-F
- switch ch {
- case 'a':
- return 'A'
- case 'b':
- return 'B'
- case 'c':
- return 'C'
- case 'd':
- return 'D'
- case 'e':
- return 'E'
- case 'f':
- return 'F'
- default:
- return ch
- }
-}
-
-// SetVersion sets the version bits.
-func (u *UUID) SetVersion(v byte) {
- u[6] = (u[6] & 0x0f) | (v << 4)
-}
-
-// SetVariant sets the variant bits.
-func (u *UUID) SetVariant(v byte) {
- switch v {
- case VariantNCS:
- u[8] = (u[8]&(0xff>>1) | (0x00 << 7))
- case VariantRFC4122:
- u[8] = (u[8]&(0xff>>2) | (0x02 << 6))
- case VariantMicrosoft:
- u[8] = (u[8]&(0xff>>3) | (0x06 << 5))
- case VariantFuture:
- fallthrough
- default:
- u[8] = (u[8]&(0xff>>3) | (0x07 << 5))
- }
-}
-
-// Must is a helper that wraps a call to a function returning (UUID, error)
-// and panics if the error is non-nil. It is intended for use in variable
-// initializations such as
-// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000"))
-func Must(u UUID, err error) UUID {
- if err != nil {
- panic(err)
- }
- return u
-}
diff --git a/vendor/github.com/rubiojr/go-vhd/LICENSE b/vendor/github.com/rubiojr/go-vhd/LICENSE
deleted file mode 100644
index d1f09ff0f6..0000000000
--- a/vendor/github.com/rubiojr/go-vhd/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Sergio Rubio
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/vendor/github.com/rubiojr/go-vhd/vhd/util.go b/vendor/github.com/rubiojr/go-vhd/vhd/util.go
deleted file mode 100644
index 7dd7170077..0000000000
--- a/vendor/github.com/rubiojr/go-vhd/vhd/util.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package vhd
-
-import (
- "encoding/hex"
- "fmt"
- "os"
- "strings"
-)
-
-// https://groups.google.com/forum/#!msg/golang-nuts/d0nF_k4dSx4/rPGgfXv6QCoJ
-func uuidgen() string {
- b := uuidgenBytes()
- return fmt.Sprintf("%x-%x-%x-%x-%x",
- b[0:4], b[4:6], b[6:8], b[8:10], b[10:])
-}
-
-func fmtField(name, value string) {
- fmt.Printf("%-25s%s\n", name+":", value)
-}
-
-func uuidgenBytes() []byte {
- f, err := os.Open("/dev/urandom")
- check(err)
- b := make([]byte, 16)
- f.Read(b)
- return b
-}
-
-func check(e error) {
- if e != nil {
- panic(e)
- }
-}
-
-func hexs(a []byte) string {
- return "0x" + hex.EncodeToString(a[:])
-}
-
-func uuid(a []byte) string {
- return fmt.Sprintf("%08x-%04x-%04x-%04x-%04x",
- a[:4],
- a[4:6],
- a[6:8],
- a[8:10],
- a[10:16])
-}
-
-func uuidToBytes(uuid string) []byte {
- s := strings.Replace(uuid, "-", "", -1)
- h, err := hex.DecodeString(s)
- check(err)
-
- return h
-}
diff --git a/vendor/github.com/rubiojr/go-vhd/vhd/vhd.go b/vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
deleted file mode 100644
index 2c86e05e9a..0000000000
--- a/vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
+++ /dev/null
@@ -1,489 +0,0 @@
-// Package to work with VHD images
-// See https://technet.microsoft.com/en-us/virtualization/bb676673.aspx
-package vhd
-
-import (
- "bytes"
- "encoding/binary"
- "encoding/hex"
- "fmt"
- "math"
- "os"
- "strconv"
- "time"
-
- "golang.org/x/text/encoding/unicode"
- "golang.org/x/text/transform"
-)
-
-const VHD_COOKIE = "636f6e6563746978" // conectix
-const VHD_DYN_COOKIE = "6378737061727365" // cxsparse
-const VHD_CREATOR_APP = "676f2d766864" // go-vhd
-const VHD_CREATOR_HOST_OS = "5769326B" // Win2k
-const VHD_BLOCK_SIZE = 2 * 1024 * 1024 // 2MB
-const VHD_HEADER_SIZE = 512
-const SECTOR_SIZE = 512
-const FOURK_SECTOR_SIZE = 4096
-const VHD_EXTRA_HEADER_SIZE = 1024
-
-// A VDH file
-type VHD struct {
- Footer VHDHeader
- ExtraHeader VHDExtraHeader
-}
-
-// VHD Header
-type VHDHeader struct {
- Cookie [8]byte
- Features [4]byte
- FileFormatVersion [4]byte
- DataOffset [8]byte
- Timestamp [4]byte
- CreatorApplication [4]byte
- CreatorVersion [4]byte
- CreatorHostOS [4]byte
- OriginalSize [8]byte
- CurrentSize [8]byte
- DiskGeometry [4]byte
- DiskType [4]byte
- Checksum [4]byte
- UniqueId [16]byte
- SavedState [1]byte
- Reserved [427]byte
-}
-
-// VHD extra header, for dynamic and differential disks
-type VHDExtraHeader struct {
- Cookie [8]byte
- DataOffset [8]byte
- TableOffset [8]byte
- HeaderVersion [4]byte
- MaxTableEntries [4]byte
- BlockSize [4]byte
- Checksum [4]byte
- ParentUUID [16]byte
- ParentTimestamp [4]byte
- Reserved [4]byte
- ParentUnicodeName [512]byte
- ParentLocatorEntry1 [24]byte
- ParentLocatorEntry2 [24]byte
- ParentLocatorEntry3 [24]byte
- ParentLocatorEntry4 [24]byte
- ParentLocatorEntry5 [24]byte
- ParentLocatorEntry6 [24]byte
- ParentLocatorEntry7 [24]byte
- ParentLocatorEntry8 [24]byte
- Reserved2 [256]byte
-}
-
-// Options for the CreateSparseVHD function
-type VHDOptions struct {
- UUID string
- Timestamp int64
-}
-
-/*
- * VHDExtraHeader methods
- */
-
-func (header *VHDExtraHeader) CookieString() string {
- return string(header.Cookie[:])
-}
-
-// Calculate and add the VHD dynamic/differential header checksum
-func (h *VHDExtraHeader) addChecksum() {
- buffer := new(bytes.Buffer)
- binary.Write(buffer, binary.BigEndian, h)
- checksum := 0
- bb := buffer.Bytes()
-
- for counter := 0; counter < VHD_EXTRA_HEADER_SIZE; counter++ {
- checksum += int(bb[counter])
- }
-
- binary.BigEndian.PutUint32(h.Checksum[:], uint32(^checksum))
-}
-
-/*
- * VHDHeader methods
- */
-
-func (h *VHDHeader) DiskTypeStr() (dt string) {
- switch h.DiskType[3] {
- case 0x00:
- dt = "None"
- case 0x01:
- dt = "Deprecated"
- case 0x02:
- dt = "Fixed"
- case 0x03:
- dt = "Dynamic"
- case 0x04:
- dt = "Differential"
- case 0x05:
- dt = "Reserved"
- case 0x06:
- dt = "Reserved"
- default:
- panic("Invalid disk type detected!")
- }
-
- return
-}
-
-// Return the timestamp of the header
-func (h *VHDHeader) TimestampTime() time.Time {
- tstamp := binary.BigEndian.Uint32(h.Timestamp[:])
- return time.Unix(int64(946684800+tstamp), 0)
-}
-
-// Calculate and add the VHD header checksum
-func (h *VHDHeader) addChecksum() {
- buffer := new(bytes.Buffer)
- binary.Write(buffer, binary.BigEndian, h)
- checksum := 0
- bb := buffer.Bytes()
-
- for counter := 0; counter < VHD_HEADER_SIZE; counter++ {
- checksum += int(bb[counter])
- }
-
- binary.BigEndian.PutUint32(h.Checksum[:], uint32(^checksum))
-}
-
-func CreateFixedHeader(size uint64, options *VHDOptions) VHDHeader {
- header := VHDHeader{}
- hexToField(VHD_COOKIE, header.Cookie[:])
- hexToField("00000002", header.Features[:])
- hexToField("00010000", header.FileFormatVersion[:])
- hexToField("ffffffffffffffff", header.DataOffset[:])
-
- // LOL Y2038
- if options.Timestamp != 0 {
- binary.BigEndian.PutUint32(header.Timestamp[:], uint32(options.Timestamp))
- } else {
- t := uint32(time.Now().Unix() - 946684800)
- binary.BigEndian.PutUint32(header.Timestamp[:], t)
- }
-
- hexToField(VHD_CREATOR_APP, header.CreatorApplication[:])
- hexToField(VHD_CREATOR_HOST_OS, header.CreatorHostOS[:])
- binary.BigEndian.PutUint64(header.OriginalSize[:], size)
- binary.BigEndian.PutUint64(header.CurrentSize[:], size)
-
- // total sectors = disk size / 512b sector size
- totalSectors := math.Floor(float64(size / 512))
- // [C, H, S]
- geometry := calculateCHS(uint64(totalSectors))
- binary.BigEndian.PutUint16(header.DiskGeometry[:2], uint16(geometry[0]))
- header.DiskGeometry[2] = uint8(geometry[1])
- header.DiskGeometry[3] = uint8(geometry[2])
-
- hexToField("00000002", header.DiskType[:]) // Fixed 0x00000002
- hexToField("00000000", header.Checksum[:])
-
- if options.UUID != "" {
- copy(header.UniqueId[:], uuidToBytes(options.UUID))
- } else {
- copy(header.UniqueId[:], uuidgenBytes())
- }
-
- header.addChecksum()
- return header
-}
-
-func RawToFixed(f *os.File, options *VHDOptions) {
- info, err := f.Stat()
- check(err)
- size := uint64(info.Size())
- header := CreateFixedHeader(size, options)
- binary.Write(f, binary.BigEndian, header)
-}
-
-func VHDCreateSparse(size uint64, name string, options VHDOptions) VHD {
- header := VHDHeader{}
- hexToField(VHD_COOKIE, header.Cookie[:])
- hexToField("00000002", header.Features[:])
- hexToField("00010000", header.FileFormatVersion[:])
- hexToField("0000000000000200", header.DataOffset[:])
-
- // LOL Y2038
- if options.Timestamp != 0 {
- binary.BigEndian.PutUint32(header.Timestamp[:], uint32(options.Timestamp))
- } else {
- t := uint32(time.Now().Unix() - 946684800)
- binary.BigEndian.PutUint32(header.Timestamp[:], t)
- }
-
- hexToField(VHD_CREATOR_APP, header.CreatorApplication[:])
- hexToField(VHD_CREATOR_HOST_OS, header.CreatorHostOS[:])
- binary.BigEndian.PutUint64(header.OriginalSize[:], size)
- binary.BigEndian.PutUint64(header.CurrentSize[:], size)
-
- // total sectors = disk size / 512b sector size
- totalSectors := math.Floor(float64(size / 512))
- // [C, H, S]
- geometry := calculateCHS(uint64(totalSectors))
- binary.BigEndian.PutUint16(header.DiskGeometry[:2], uint16(geometry[0]))
- header.DiskGeometry[2] = uint8(geometry[1])
- header.DiskGeometry[3] = uint8(geometry[2])
-
- hexToField("00000003", header.DiskType[:]) // Sparse 0x00000003
- hexToField("00000000", header.Checksum[:])
-
- if options.UUID != "" {
- copy(header.UniqueId[:], uuidToBytes(options.UUID))
- } else {
- copy(header.UniqueId[:], uuidgenBytes())
- }
-
- header.addChecksum()
-
- // Fill the sparse header
- header2 := VHDExtraHeader{}
- hexToField(VHD_DYN_COOKIE, header2.Cookie[:])
- hexToField("ffffffffffffffff", header2.DataOffset[:])
- // header size + sparse header size
- binary.BigEndian.PutUint64(header2.TableOffset[:], uint64(VHD_EXTRA_HEADER_SIZE+VHD_HEADER_SIZE))
- hexToField("00010000", header2.HeaderVersion[:])
-
- maxTableSize := uint32(size / (VHD_BLOCK_SIZE))
- binary.BigEndian.PutUint32(header2.MaxTableEntries[:], maxTableSize)
-
- binary.BigEndian.PutUint32(header2.BlockSize[:], VHD_BLOCK_SIZE)
- binary.BigEndian.PutUint32(header2.ParentTimestamp[:], uint32(0))
- header2.addChecksum()
-
- f, err := os.Create(name)
- check(err)
- defer f.Close()
-
- binary.Write(f, binary.BigEndian, header)
- binary.Write(f, binary.BigEndian, header2)
-
- /*
- Write BAT entries
- The BAT is always extended to a sector (4K) boundary
- 1536 = 512 + 1024 (the VHD Header + VHD Sparse header size)
- */
- for count := uint32(0); count < (FOURK_SECTOR_SIZE - 1536); count += 1 {
- f.Write([]byte{0xff})
- }
-
- /* Windows creates 8K VHDs by default */
- for i := 0; i < (FOURK_SECTOR_SIZE - VHD_HEADER_SIZE); i += 1 {
- f.Write([]byte{0x0})
- }
-
- binary.Write(f, binary.BigEndian, header)
-
- return VHD{
- Footer: header,
- ExtraHeader: header2,
- }
-}
-
-/*
- * VHD
- */
-
-func FromFile(f *os.File) (vhd VHD) {
- vhd = VHD{}
- vhd.Footer = readVHDFooter(f)
- vhd.ExtraHeader = readVHDExtraHeader(f)
-
- return vhd
-}
-
-func (vhd *VHD) PrintInfo() {
- fmt.Println("\nVHD footer")
- fmt.Println("==========")
- vhd.PrintFooter()
-
- if vhd.Footer.DiskType[3] == 0x3 || vhd.Footer.DiskType[3] == 0x04 {
- fmt.Println("\nVHD sparse/differential header")
- fmt.Println("===============================")
- vhd.PrintExtraHeader()
- }
-}
-
-func (vhd *VHD) PrintExtraHeader() {
- header := vhd.ExtraHeader
-
- fmtField("Cookie", fmt.Sprintf("%s (%s)",
- hexs(header.Cookie[:]), header.CookieString()))
- fmtField("Data offset", hexs(header.DataOffset[:]))
- fmtField("Table offset", hexs(header.TableOffset[:]))
- fmtField("Header version", hexs(header.HeaderVersion[:]))
- fmtField("Max table entries", hexs(header.MaxTableEntries[:]))
- fmtField("Block size", hexs(header.BlockSize[:]))
- fmtField("Checksum", hexs(header.Checksum[:]))
- fmtField("Parent UUID", uuid(header.ParentUUID[:]))
-
- // Seconds since January 1, 1970 12:00:00 AM in UTC/GMT.
- // 946684800 = January 1, 2000 12:00:00 AM in UTC/GMT.
- tstamp := binary.BigEndian.Uint32(header.ParentTimestamp[:])
- t := time.Unix(int64(946684800+tstamp), 0)
- fmtField("Parent timestamp", fmt.Sprintf("%s", t))
-
- fmtField("Reserved", hexs(header.Reserved[:]))
- parentNameBytes, _, err := transform.Bytes(
- unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewDecoder(),
- header.ParentUnicodeName[:],
- )
- if err != nil {
- panic(err)
- }
- parentName := string(parentNameBytes)
- fmtField("Parent Name", parentName)
- // Parent locator entries ignored since it's a dynamic disk
- sum := 0
- for _, b := range header.Reserved2 {
- sum += int(b)
- }
- fmtField("Reserved2", strconv.Itoa(sum))
-}
-
-func (vhd *VHD) PrintFooter() {
- header := vhd.Footer
-
- //fmtField("Cookie", string(header.Cookie[:]))
- fmtField("Cookie", fmt.Sprintf("%s (%s)",
- hexs(header.Cookie[:]), string(header.Cookie[:])))
- fmtField("Features", hexs(header.Features[:]))
- fmtField("File format version", hexs(header.FileFormatVersion[:]))
-
- dataOffset := binary.BigEndian.Uint64(header.DataOffset[:])
- fmtField("Data offset",
- fmt.Sprintf("%s (%d bytes)", hexs(header.DataOffset[:]), dataOffset))
-
- //// Seconds since January 1, 1970 12:00:00 AM in UTC/GMT.
- //// 946684800 = January 1, 2000 12:00:00 AM in UTC/GMT.
- t := time.Unix(int64(946684800+binary.BigEndian.Uint32(header.Timestamp[:])), 0)
- fmtField("Timestamp", fmt.Sprintf("%s", t))
-
- fmtField("Creator application", string(header.CreatorApplication[:]))
- fmtField("Creator version", hexs(header.CreatorVersion[:]))
- fmtField("Creator OS", string(header.CreatorHostOS[:]))
-
- originalSize := binary.BigEndian.Uint64(header.OriginalSize[:])
- fmtField("Original size",
- fmt.Sprintf("%s ( %d bytes )", hexs(header.OriginalSize[:]), originalSize))
-
- currentSize := binary.BigEndian.Uint64(header.OriginalSize[:])
- fmtField("Current size",
- fmt.Sprintf("%s ( %d bytes )", hexs(header.CurrentSize[:]), currentSize))
-
- cilinders := int64(binary.BigEndian.Uint16(header.DiskGeometry[:2]))
- heads := int64(header.DiskGeometry[2])
- sectors := int64(header.DiskGeometry[3])
- dsize := cilinders * heads * sectors * 512
- fmtField("Disk geometry",
- fmt.Sprintf("%s (c: %d, h: %d, s: %d) (%d bytes)",
- hexs(header.DiskGeometry[:]),
- cilinders,
- heads,
- sectors,
- dsize))
-
- fmtField("Disk type",
- fmt.Sprintf("%s (%s)", hexs(header.DiskType[:]), header.DiskTypeStr()))
-
- fmtField("Checksum", hexs(header.Checksum[:]))
- fmtField("UUID", uuid(header.UniqueId[:]))
- fmtField("Saved state", fmt.Sprintf("%d", header.SavedState[0]))
-}
-
-/*
- Utility functions
-*/
-func calculateCHS(ts uint64) []uint {
- var sectorsPerTrack,
- heads,
- cylinderTimesHeads,
- cylinders float64
- totalSectors := float64(ts)
-
- ret := make([]uint, 3)
-
- if totalSectors > 65535*16*255 {
- totalSectors = 65535 * 16 * 255
- }
-
- if totalSectors >= 65535*16*63 {
- sectorsPerTrack = 255
- heads = 16
- cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
- } else {
- sectorsPerTrack = 17
- cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
- heads = math.Floor((cylinderTimesHeads + 1023) / 1024)
- if heads < 4 {
- heads = 4
- }
- if (cylinderTimesHeads >= (heads * 1024)) || heads > 16 {
- sectorsPerTrack = 31
- heads = 16
- cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
- }
- if cylinderTimesHeads >= (heads * 1024) {
- sectorsPerTrack = 63
- heads = 16
- cylinderTimesHeads = math.Floor(totalSectors / sectorsPerTrack)
- }
- }
-
- cylinders = cylinderTimesHeads / heads
-
- // This will floor the values
- ret[0] = uint(cylinders)
- ret[1] = uint(heads)
- ret[2] = uint(sectorsPerTrack)
-
- return ret
-}
-
-func hexToField(hexs string, field []byte) {
- h, err := hex.DecodeString(hexs)
- check(err)
-
- copy(field, h)
-}
-
-// Return the number of blocks in the disk, diskSize in bytes
-func getMaxTableEntries(diskSize uint64) uint64 {
- return diskSize * (2 * 1024 * 1024) // block size is 2M
-}
-
-func readVHDExtraHeader(f *os.File) (header VHDExtraHeader) {
- buff := make([]byte, 1024)
- _, err := f.ReadAt(buff, 512)
- check(err)
-
- binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
-
- return header
-}
-
-func readVHDFooter(f *os.File) (header VHDHeader) {
- info, err := f.Stat()
- check(err)
-
- buff := make([]byte, 512)
- _, err = f.ReadAt(buff, info.Size()-512)
- check(err)
-
- binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
-
- return header
-}
-
-func readVHDHeader(f *os.File) (header VHDHeader) {
- buff := make([]byte, 512)
- _, err := f.ReadAt(buff, 0)
- check(err)
-
- binary.Read(bytes.NewBuffer(buff[:]), binary.BigEndian, &header)
-
- return header
-}
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
index 8fb49a13e3..63cae9e6f0 100644
--- a/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
+++ b/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build go1.11 && gc && !purego
// +build go1.11,gc,!purego
#include "textflag.h"
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s
index 3dad4b2fa2..5c0fed26f8 100644
--- a/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s
+++ b/vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s
@@ -19,6 +19,7 @@
// The differences in this and the original implementation are
// due to the calling conventions and initialization of constants.
+//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"
diff --git a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
index 818161189b..f3ef5a019d 100644
--- a/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
+++ b/vendor/golang.org/x/crypto/chacha20/chacha_s390x.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc && !purego
// +build gc,!purego
#include "go_asm.h"
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519.go b/vendor/golang.org/x/crypto/curve25519/curve25519.go
index 4b9a655d1b..cda3fdd354 100644
--- a/vendor/golang.org/x/crypto/curve25519/curve25519.go
+++ b/vendor/golang.org/x/crypto/curve25519/curve25519.go
@@ -10,6 +10,8 @@ package curve25519 // import "golang.org/x/crypto/curve25519"
import (
"crypto/subtle"
"fmt"
+
+ "golang.org/x/crypto/curve25519/internal/field"
)
// ScalarMult sets dst to the product scalar * point.
@@ -18,7 +20,55 @@ import (
// zeroes, irrespective of the scalar. Instead, use the X25519 function, which
// will return an error.
func ScalarMult(dst, scalar, point *[32]byte) {
- scalarMult(dst, scalar, point)
+ var e [32]byte
+
+ copy(e[:], scalar[:])
+ e[0] &= 248
+ e[31] &= 127
+ e[31] |= 64
+
+ var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element
+ x1.SetBytes(point[:])
+ x2.One()
+ x3.Set(&x1)
+ z3.One()
+
+ swap := 0
+ for pos := 254; pos >= 0; pos-- {
+ b := e[pos/8] >> uint(pos&7)
+ b &= 1
+ swap ^= int(b)
+ x2.Swap(&x3, swap)
+ z2.Swap(&z3, swap)
+ swap = int(b)
+
+ tmp0.Subtract(&x3, &z3)
+ tmp1.Subtract(&x2, &z2)
+ x2.Add(&x2, &z2)
+ z2.Add(&x3, &z3)
+ z3.Multiply(&tmp0, &x2)
+ z2.Multiply(&z2, &tmp1)
+ tmp0.Square(&tmp1)
+ tmp1.Square(&x2)
+ x3.Add(&z3, &z2)
+ z2.Subtract(&z3, &z2)
+ x2.Multiply(&tmp1, &tmp0)
+ tmp1.Subtract(&tmp1, &tmp0)
+ z2.Square(&z2)
+
+ z3.Mult32(&tmp1, 121666)
+ x3.Square(&x3)
+ tmp0.Add(&tmp0, &z3)
+ z3.Multiply(&x1, &z2)
+ z2.Multiply(&tmp1, &tmp0)
+ }
+
+ x2.Swap(&x3, swap)
+ z2.Swap(&z3, swap)
+
+ z2.Invert(&z2)
+ x2.Multiply(&x2, &z2)
+ copy(dst[:], x2.Bytes())
}
// ScalarBaseMult sets dst to the product scalar * base where base is the
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.go b/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.go
deleted file mode 100644
index 84858480df..0000000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.go
+++ /dev/null
@@ -1,241 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build amd64 && gc && !purego
-// +build amd64,gc,!purego
-
-package curve25519
-
-// These functions are implemented in the .s files. The names of the functions
-// in the rest of the file are also taken from the SUPERCOP sources to help
-// people following along.
-
-//go:noescape
-
-func cswap(inout *[5]uint64, v uint64)
-
-//go:noescape
-
-func ladderstep(inout *[5][5]uint64)
-
-//go:noescape
-
-func freeze(inout *[5]uint64)
-
-//go:noescape
-
-func mul(dest, a, b *[5]uint64)
-
-//go:noescape
-
-func square(out, in *[5]uint64)
-
-// mladder uses a Montgomery ladder to calculate (xr/zr) *= s.
-func mladder(xr, zr *[5]uint64, s *[32]byte) {
- var work [5][5]uint64
-
- work[0] = *xr
- setint(&work[1], 1)
- setint(&work[2], 0)
- work[3] = *xr
- setint(&work[4], 1)
-
- j := uint(6)
- var prevbit byte
-
- for i := 31; i >= 0; i-- {
- for j < 8 {
- bit := ((*s)[i] >> j) & 1
- swap := bit ^ prevbit
- prevbit = bit
- cswap(&work[1], uint64(swap))
- ladderstep(&work)
- j--
- }
- j = 7
- }
-
- *xr = work[1]
- *zr = work[2]
-}
-
-func scalarMult(out, in, base *[32]byte) {
- var e [32]byte
- copy(e[:], (*in)[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var t, z [5]uint64
- unpack(&t, base)
- mladder(&t, &z, &e)
- invert(&z, &z)
- mul(&t, &t, &z)
- pack(out, &t)
-}
-
-func setint(r *[5]uint64, v uint64) {
- r[0] = v
- r[1] = 0
- r[2] = 0
- r[3] = 0
- r[4] = 0
-}
-
-// unpack sets r = x where r consists of 5, 51-bit limbs in little-endian
-// order.
-func unpack(r *[5]uint64, x *[32]byte) {
- r[0] = uint64(x[0]) |
- uint64(x[1])<<8 |
- uint64(x[2])<<16 |
- uint64(x[3])<<24 |
- uint64(x[4])<<32 |
- uint64(x[5])<<40 |
- uint64(x[6]&7)<<48
-
- r[1] = uint64(x[6])>>3 |
- uint64(x[7])<<5 |
- uint64(x[8])<<13 |
- uint64(x[9])<<21 |
- uint64(x[10])<<29 |
- uint64(x[11])<<37 |
- uint64(x[12]&63)<<45
-
- r[2] = uint64(x[12])>>6 |
- uint64(x[13])<<2 |
- uint64(x[14])<<10 |
- uint64(x[15])<<18 |
- uint64(x[16])<<26 |
- uint64(x[17])<<34 |
- uint64(x[18])<<42 |
- uint64(x[19]&1)<<50
-
- r[3] = uint64(x[19])>>1 |
- uint64(x[20])<<7 |
- uint64(x[21])<<15 |
- uint64(x[22])<<23 |
- uint64(x[23])<<31 |
- uint64(x[24])<<39 |
- uint64(x[25]&15)<<47
-
- r[4] = uint64(x[25])>>4 |
- uint64(x[26])<<4 |
- uint64(x[27])<<12 |
- uint64(x[28])<<20 |
- uint64(x[29])<<28 |
- uint64(x[30])<<36 |
- uint64(x[31]&127)<<44
-}
-
-// pack sets out = x where out is the usual, little-endian form of the 5,
-// 51-bit limbs in x.
-func pack(out *[32]byte, x *[5]uint64) {
- t := *x
- freeze(&t)
-
- out[0] = byte(t[0])
- out[1] = byte(t[0] >> 8)
- out[2] = byte(t[0] >> 16)
- out[3] = byte(t[0] >> 24)
- out[4] = byte(t[0] >> 32)
- out[5] = byte(t[0] >> 40)
- out[6] = byte(t[0] >> 48)
-
- out[6] ^= byte(t[1]<<3) & 0xf8
- out[7] = byte(t[1] >> 5)
- out[8] = byte(t[1] >> 13)
- out[9] = byte(t[1] >> 21)
- out[10] = byte(t[1] >> 29)
- out[11] = byte(t[1] >> 37)
- out[12] = byte(t[1] >> 45)
-
- out[12] ^= byte(t[2]<<6) & 0xc0
- out[13] = byte(t[2] >> 2)
- out[14] = byte(t[2] >> 10)
- out[15] = byte(t[2] >> 18)
- out[16] = byte(t[2] >> 26)
- out[17] = byte(t[2] >> 34)
- out[18] = byte(t[2] >> 42)
- out[19] = byte(t[2] >> 50)
-
- out[19] ^= byte(t[3]<<1) & 0xfe
- out[20] = byte(t[3] >> 7)
- out[21] = byte(t[3] >> 15)
- out[22] = byte(t[3] >> 23)
- out[23] = byte(t[3] >> 31)
- out[24] = byte(t[3] >> 39)
- out[25] = byte(t[3] >> 47)
-
- out[25] ^= byte(t[4]<<4) & 0xf0
- out[26] = byte(t[4] >> 4)
- out[27] = byte(t[4] >> 12)
- out[28] = byte(t[4] >> 20)
- out[29] = byte(t[4] >> 28)
- out[30] = byte(t[4] >> 36)
- out[31] = byte(t[4] >> 44)
-}
-
-// invert calculates r = x^-1 mod p using Fermat's little theorem.
-func invert(r *[5]uint64, x *[5]uint64) {
- var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t [5]uint64
-
- square(&z2, x) /* 2 */
- square(&t, &z2) /* 4 */
- square(&t, &t) /* 8 */
- mul(&z9, &t, x) /* 9 */
- mul(&z11, &z9, &z2) /* 11 */
- square(&t, &z11) /* 22 */
- mul(&z2_5_0, &t, &z9) /* 2^5 - 2^0 = 31 */
-
- square(&t, &z2_5_0) /* 2^6 - 2^1 */
- for i := 1; i < 5; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_10_0, &t, &z2_5_0) /* 2^10 - 2^0 */
-
- square(&t, &z2_10_0) /* 2^11 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^20 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_20_0, &t, &z2_10_0) /* 2^20 - 2^0 */
-
- square(&t, &z2_20_0) /* 2^21 - 2^1 */
- for i := 1; i < 20; i++ { /* 2^40 - 2^20 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_20_0) /* 2^40 - 2^0 */
-
- square(&t, &t) /* 2^41 - 2^1 */
- for i := 1; i < 10; i++ { /* 2^50 - 2^10 */
- square(&t, &t)
- }
- mul(&z2_50_0, &t, &z2_10_0) /* 2^50 - 2^0 */
-
- square(&t, &z2_50_0) /* 2^51 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^100 - 2^50 */
- square(&t, &t)
- }
- mul(&z2_100_0, &t, &z2_50_0) /* 2^100 - 2^0 */
-
- square(&t, &z2_100_0) /* 2^101 - 2^1 */
- for i := 1; i < 100; i++ { /* 2^200 - 2^100 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_100_0) /* 2^200 - 2^0 */
-
- square(&t, &t) /* 2^201 - 2^1 */
- for i := 1; i < 50; i++ { /* 2^250 - 2^50 */
- square(&t, &t)
- }
- mul(&t, &t, &z2_50_0) /* 2^250 - 2^0 */
-
- square(&t, &t) /* 2^251 - 2^1 */
- square(&t, &t) /* 2^252 - 2^2 */
- square(&t, &t) /* 2^253 - 2^3 */
-
- square(&t, &t) /* 2^254 - 2^4 */
-
- square(&t, &t) /* 2^255 - 2^5 */
- mul(r, &t, &z11) /* 2^255 - 21 */
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.s b/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.s
deleted file mode 100644
index 6c53380926..0000000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519_amd64.s
+++ /dev/null
@@ -1,1793 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// This code was translated into a form compatible with 6a from the public
-// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
-
-// +build amd64,gc,!purego
-
-#define REDMASK51 0x0007FFFFFFFFFFFF
-
-// These constants cannot be encoded in non-MOVQ immediates.
-// We access them directly from memory instead.
-
-DATA ·_121666_213(SB)/8, $996687872
-GLOBL ·_121666_213(SB), 8, $8
-
-DATA ·_2P0(SB)/8, $0xFFFFFFFFFFFDA
-GLOBL ·_2P0(SB), 8, $8
-
-DATA ·_2P1234(SB)/8, $0xFFFFFFFFFFFFE
-GLOBL ·_2P1234(SB), 8, $8
-
-// func freeze(inout *[5]uint64)
-TEXT ·freeze(SB),7,$0-8
- MOVQ inout+0(FP), DI
-
- MOVQ 0(DI),SI
- MOVQ 8(DI),DX
- MOVQ 16(DI),CX
- MOVQ 24(DI),R8
- MOVQ 32(DI),R9
- MOVQ $REDMASK51,AX
- MOVQ AX,R10
- SUBQ $18,R10
- MOVQ $3,R11
-REDUCELOOP:
- MOVQ SI,R12
- SHRQ $51,R12
- ANDQ AX,SI
- ADDQ R12,DX
- MOVQ DX,R12
- SHRQ $51,R12
- ANDQ AX,DX
- ADDQ R12,CX
- MOVQ CX,R12
- SHRQ $51,R12
- ANDQ AX,CX
- ADDQ R12,R8
- MOVQ R8,R12
- SHRQ $51,R12
- ANDQ AX,R8
- ADDQ R12,R9
- MOVQ R9,R12
- SHRQ $51,R12
- ANDQ AX,R9
- IMUL3Q $19,R12,R12
- ADDQ R12,SI
- SUBQ $1,R11
- JA REDUCELOOP
- MOVQ $1,R12
- CMPQ R10,SI
- CMOVQLT R11,R12
- CMPQ AX,DX
- CMOVQNE R11,R12
- CMPQ AX,CX
- CMOVQNE R11,R12
- CMPQ AX,R8
- CMOVQNE R11,R12
- CMPQ AX,R9
- CMOVQNE R11,R12
- NEGQ R12
- ANDQ R12,AX
- ANDQ R12,R10
- SUBQ R10,SI
- SUBQ AX,DX
- SUBQ AX,CX
- SUBQ AX,R8
- SUBQ AX,R9
- MOVQ SI,0(DI)
- MOVQ DX,8(DI)
- MOVQ CX,16(DI)
- MOVQ R8,24(DI)
- MOVQ R9,32(DI)
- RET
-
-// func ladderstep(inout *[5][5]uint64)
-TEXT ·ladderstep(SB),0,$296-8
- MOVQ inout+0(FP),DI
-
- MOVQ 40(DI),SI
- MOVQ 48(DI),DX
- MOVQ 56(DI),CX
- MOVQ 64(DI),R8
- MOVQ 72(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 80(DI),SI
- ADDQ 88(DI),DX
- ADDQ 96(DI),CX
- ADDQ 104(DI),R8
- ADDQ 112(DI),R9
- SUBQ 80(DI),AX
- SUBQ 88(DI),R10
- SUBQ 96(DI),R11
- SUBQ 104(DI),R12
- SUBQ 112(DI),R13
- MOVQ SI,0(SP)
- MOVQ DX,8(SP)
- MOVQ CX,16(SP)
- MOVQ R8,24(SP)
- MOVQ R9,32(SP)
- MOVQ AX,40(SP)
- MOVQ R10,48(SP)
- MOVQ R11,56(SP)
- MOVQ R12,64(SP)
- MOVQ R13,72(SP)
- MOVQ 40(SP),AX
- MULQ 40(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 48(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 56(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 64(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 40(SP),AX
- SHLQ $1,AX
- MULQ 72(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 48(SP),AX
- MULQ 48(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 48(SP),AX
- SHLQ $1,AX
- MULQ 56(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 48(SP),AX
- SHLQ $1,AX
- MULQ 64(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 48(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 56(SP),AX
- MULQ 56(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 56(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 64(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 56(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 64(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 64(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 72(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 72(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,80(SP)
- MOVQ R8,88(SP)
- MOVQ R9,96(SP)
- MOVQ AX,104(SP)
- MOVQ R10,112(SP)
- MOVQ 0(SP),AX
- MULQ 0(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 8(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 16(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 24(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 0(SP),AX
- SHLQ $1,AX
- MULQ 32(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 8(SP),AX
- MULQ 8(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- SHLQ $1,AX
- MULQ 16(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SP),AX
- SHLQ $1,AX
- MULQ 24(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 16(SP),AX
- MULQ 16(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 16(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 24(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 16(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 24(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 24(SP),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 32(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,120(SP)
- MOVQ R8,128(SP)
- MOVQ R9,136(SP)
- MOVQ AX,144(SP)
- MOVQ R10,152(SP)
- MOVQ SI,SI
- MOVQ R8,DX
- MOVQ R9,CX
- MOVQ AX,R8
- MOVQ R10,R9
- ADDQ ·_2P0(SB),SI
- ADDQ ·_2P1234(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R8
- ADDQ ·_2P1234(SB),R9
- SUBQ 80(SP),SI
- SUBQ 88(SP),DX
- SUBQ 96(SP),CX
- SUBQ 104(SP),R8
- SUBQ 112(SP),R9
- MOVQ SI,160(SP)
- MOVQ DX,168(SP)
- MOVQ CX,176(SP)
- MOVQ R8,184(SP)
- MOVQ R9,192(SP)
- MOVQ 120(DI),SI
- MOVQ 128(DI),DX
- MOVQ 136(DI),CX
- MOVQ 144(DI),R8
- MOVQ 152(DI),R9
- MOVQ SI,AX
- MOVQ DX,R10
- MOVQ CX,R11
- MOVQ R8,R12
- MOVQ R9,R13
- ADDQ ·_2P0(SB),AX
- ADDQ ·_2P1234(SB),R10
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 160(DI),SI
- ADDQ 168(DI),DX
- ADDQ 176(DI),CX
- ADDQ 184(DI),R8
- ADDQ 192(DI),R9
- SUBQ 160(DI),AX
- SUBQ 168(DI),R10
- SUBQ 176(DI),R11
- SUBQ 184(DI),R12
- SUBQ 192(DI),R13
- MOVQ SI,200(SP)
- MOVQ DX,208(SP)
- MOVQ CX,216(SP)
- MOVQ R8,224(SP)
- MOVQ R9,232(SP)
- MOVQ AX,240(SP)
- MOVQ R10,248(SP)
- MOVQ R11,256(SP)
- MOVQ R12,264(SP)
- MOVQ R13,272(SP)
- MOVQ 224(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,280(SP)
- MULQ 56(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 232(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,288(SP)
- MULQ 48(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 200(SP),AX
- MULQ 40(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 200(SP),AX
- MULQ 48(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 200(SP),AX
- MULQ 56(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 200(SP),AX
- MULQ 64(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 200(SP),AX
- MULQ 72(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 208(SP),AX
- MULQ 40(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 208(SP),AX
- MULQ 48(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 208(SP),AX
- MULQ 56(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 208(SP),AX
- MULQ 64(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 208(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 216(SP),AX
- MULQ 40(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 216(SP),AX
- MULQ 48(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 216(SP),AX
- MULQ 56(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 216(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 64(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 216(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 72(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 224(SP),AX
- MULQ 40(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 224(SP),AX
- MULQ 48(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 280(SP),AX
- MULQ 64(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 280(SP),AX
- MULQ 72(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 232(SP),AX
- MULQ 40(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 288(SP),AX
- MULQ 56(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 288(SP),AX
- MULQ 64(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 288(SP),AX
- MULQ 72(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,40(SP)
- MOVQ R8,48(SP)
- MOVQ R9,56(SP)
- MOVQ AX,64(SP)
- MOVQ R10,72(SP)
- MOVQ 264(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,200(SP)
- MULQ 16(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 272(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,208(SP)
- MULQ 8(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 240(SP),AX
- MULQ 0(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 240(SP),AX
- MULQ 8(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 240(SP),AX
- MULQ 16(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 240(SP),AX
- MULQ 24(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 240(SP),AX
- MULQ 32(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 248(SP),AX
- MULQ 0(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 248(SP),AX
- MULQ 8(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 248(SP),AX
- MULQ 16(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 248(SP),AX
- MULQ 24(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 248(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),AX
- MULQ 0(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 256(SP),AX
- MULQ 8(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 256(SP),AX
- MULQ 16(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 256(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 256(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 264(SP),AX
- MULQ 0(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 264(SP),AX
- MULQ 8(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 200(SP),AX
- MULQ 24(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 200(SP),AX
- MULQ 32(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 272(SP),AX
- MULQ 0(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 208(SP),AX
- MULQ 16(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 208(SP),AX
- MULQ 24(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 208(SP),AX
- MULQ 32(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,DX
- MOVQ R8,CX
- MOVQ R9,R11
- MOVQ AX,R12
- MOVQ R10,R13
- ADDQ ·_2P0(SB),DX
- ADDQ ·_2P1234(SB),CX
- ADDQ ·_2P1234(SB),R11
- ADDQ ·_2P1234(SB),R12
- ADDQ ·_2P1234(SB),R13
- ADDQ 40(SP),SI
- ADDQ 48(SP),R8
- ADDQ 56(SP),R9
- ADDQ 64(SP),AX
- ADDQ 72(SP),R10
- SUBQ 40(SP),DX
- SUBQ 48(SP),CX
- SUBQ 56(SP),R11
- SUBQ 64(SP),R12
- SUBQ 72(SP),R13
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ DX,160(DI)
- MOVQ CX,168(DI)
- MOVQ R11,176(DI)
- MOVQ R12,184(DI)
- MOVQ R13,192(DI)
- MOVQ 120(DI),AX
- MULQ 120(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 128(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 120(DI),AX
- SHLQ $1,AX
- MULQ 152(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 128(DI),AX
- MULQ 128(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 136(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 128(DI),AX
- SHLQ $1,AX
- MULQ 144(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 128(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),AX
- MULQ 136(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 144(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 144(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 152(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 152(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 152(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,120(DI)
- MOVQ R8,128(DI)
- MOVQ R9,136(DI)
- MOVQ AX,144(DI)
- MOVQ R10,152(DI)
- MOVQ 160(DI),AX
- MULQ 160(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 168(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- SHLQ $1,AX
- MULQ 192(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 168(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 176(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- SHLQ $1,AX
- MULQ 184(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 176(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 184(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 184(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),DX
- IMUL3Q $38,DX,AX
- MULQ 192(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- ANDQ DX,SI
- MOVQ CX,R8
- SHRQ $51,CX
- ADDQ R10,CX
- ANDQ DX,R8
- MOVQ CX,R9
- SHRQ $51,CX
- ADDQ R12,CX
- ANDQ DX,R9
- MOVQ CX,AX
- SHRQ $51,CX
- ADDQ R14,CX
- ANDQ DX,AX
- MOVQ CX,R10
- SHRQ $51,CX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 184(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 16(DI)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 192(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 8(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 0(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 160(DI),AX
- MULQ 8(DI)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 160(DI),AX
- MULQ 16(DI)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 160(DI),AX
- MULQ 24(DI)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 160(DI),AX
- MULQ 32(DI)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 168(DI),AX
- MULQ 0(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 168(DI),AX
- MULQ 8(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 168(DI),AX
- MULQ 16(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 168(DI),AX
- MULQ 24(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 168(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),AX
- MULQ 0(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 176(DI),AX
- MULQ 8(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 176(DI),AX
- MULQ 16(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(DI)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 176(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 184(DI),AX
- MULQ 0(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 184(DI),AX
- MULQ 8(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 24(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 32(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 192(DI),AX
- MULQ 0(DI)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 16(DI)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 24(DI)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 32(DI)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,160(DI)
- MOVQ R8,168(DI)
- MOVQ R9,176(DI)
- MOVQ AX,184(DI)
- MOVQ R10,192(DI)
- MOVQ 144(SP),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 96(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 152(SP),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 88(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 120(SP),AX
- MULQ 80(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 120(SP),AX
- MULQ 88(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 120(SP),AX
- MULQ 96(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 120(SP),AX
- MULQ 104(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 120(SP),AX
- MULQ 112(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 128(SP),AX
- MULQ 80(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 128(SP),AX
- MULQ 88(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 128(SP),AX
- MULQ 96(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 128(SP),AX
- MULQ 104(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 128(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 112(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(SP),AX
- MULQ 80(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 136(SP),AX
- MULQ 88(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 136(SP),AX
- MULQ 96(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 136(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 104(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 136(SP),DX
- IMUL3Q $19,DX,AX
- MULQ 112(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 144(SP),AX
- MULQ 80(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 144(SP),AX
- MULQ 88(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 104(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 112(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 152(SP),AX
- MULQ 80(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 96(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 104(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 112(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,40(DI)
- MOVQ R8,48(DI)
- MOVQ R9,56(DI)
- MOVQ AX,64(DI)
- MOVQ R10,72(DI)
- MOVQ 160(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 168(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,CX
- MOVQ DX,R8
- MOVQ 176(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R8
- MOVQ DX,R9
- MOVQ 184(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R9
- MOVQ DX,R10
- MOVQ 192(SP),AX
- MULQ ·_121666_213(SB)
- SHRQ $13,AX
- ADDQ AX,R10
- IMUL3Q $19,DX,DX
- ADDQ DX,SI
- ADDQ 80(SP),SI
- ADDQ 88(SP),CX
- ADDQ 96(SP),R8
- ADDQ 104(SP),R9
- ADDQ 112(SP),R10
- MOVQ SI,80(DI)
- MOVQ CX,88(DI)
- MOVQ R8,96(DI)
- MOVQ R9,104(DI)
- MOVQ R10,112(DI)
- MOVQ 104(DI),SI
- IMUL3Q $19,SI,AX
- MOVQ AX,0(SP)
- MULQ 176(SP)
- MOVQ AX,SI
- MOVQ DX,CX
- MOVQ 112(DI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 168(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 160(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 80(DI),AX
- MULQ 168(SP)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 80(DI),AX
- MULQ 176(SP)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 80(DI),AX
- MULQ 184(SP)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 80(DI),AX
- MULQ 192(SP)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 88(DI),AX
- MULQ 160(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 88(DI),AX
- MULQ 168(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 88(DI),AX
- MULQ 176(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 88(DI),AX
- MULQ 184(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 88(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),AX
- MULQ 160(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 96(DI),AX
- MULQ 168(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 96(DI),AX
- MULQ 176(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 184(SP)
- ADDQ AX,SI
- ADCQ DX,CX
- MOVQ 96(DI),DX
- IMUL3Q $19,DX,AX
- MULQ 192(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 104(DI),AX
- MULQ 160(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 104(DI),AX
- MULQ 168(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 0(SP),AX
- MULQ 184(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SP),AX
- MULQ 192(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 112(DI),AX
- MULQ 160(SP)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SP),AX
- MULQ 176(SP)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 8(SP),AX
- MULQ 184(SP)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 192(SP)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ $REDMASK51,DX
- SHLQ $13,SI,CX
- ANDQ DX,SI
- SHLQ $13,R8,R9
- ANDQ DX,R8
- ADDQ CX,R8
- SHLQ $13,R10,R11
- ANDQ DX,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ DX,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ DX,R14
- ADDQ R13,R14
- IMUL3Q $19,R15,CX
- ADDQ CX,SI
- MOVQ SI,CX
- SHRQ $51,CX
- ADDQ R8,CX
- MOVQ CX,R8
- SHRQ $51,CX
- ANDQ DX,SI
- ADDQ R10,CX
- MOVQ CX,R9
- SHRQ $51,CX
- ANDQ DX,R8
- ADDQ R12,CX
- MOVQ CX,AX
- SHRQ $51,CX
- ANDQ DX,R9
- ADDQ R14,CX
- MOVQ CX,R10
- SHRQ $51,CX
- ANDQ DX,AX
- IMUL3Q $19,CX,CX
- ADDQ CX,SI
- ANDQ DX,R10
- MOVQ SI,80(DI)
- MOVQ R8,88(DI)
- MOVQ R9,96(DI)
- MOVQ AX,104(DI)
- MOVQ R10,112(DI)
- RET
-
-// func cswap(inout *[4][5]uint64, v uint64)
-TEXT ·cswap(SB),7,$0
- MOVQ inout+0(FP),DI
- MOVQ v+8(FP),SI
-
- SUBQ $1, SI
- NOTQ SI
- MOVQ SI, X15
- PSHUFD $0x44, X15, X15
-
- MOVOU 0(DI), X0
- MOVOU 16(DI), X2
- MOVOU 32(DI), X4
- MOVOU 48(DI), X6
- MOVOU 64(DI), X8
- MOVOU 80(DI), X1
- MOVOU 96(DI), X3
- MOVOU 112(DI), X5
- MOVOU 128(DI), X7
- MOVOU 144(DI), X9
-
- MOVO X1, X10
- MOVO X3, X11
- MOVO X5, X12
- MOVO X7, X13
- MOVO X9, X14
-
- PXOR X0, X10
- PXOR X2, X11
- PXOR X4, X12
- PXOR X6, X13
- PXOR X8, X14
- PAND X15, X10
- PAND X15, X11
- PAND X15, X12
- PAND X15, X13
- PAND X15, X14
- PXOR X10, X0
- PXOR X10, X1
- PXOR X11, X2
- PXOR X11, X3
- PXOR X12, X4
- PXOR X12, X5
- PXOR X13, X6
- PXOR X13, X7
- PXOR X14, X8
- PXOR X14, X9
-
- MOVOU X0, 0(DI)
- MOVOU X2, 16(DI)
- MOVOU X4, 32(DI)
- MOVOU X6, 48(DI)
- MOVOU X8, 64(DI)
- MOVOU X1, 80(DI)
- MOVOU X3, 96(DI)
- MOVOU X5, 112(DI)
- MOVOU X7, 128(DI)
- MOVOU X9, 144(DI)
- RET
-
-// func mul(dest, a, b *[5]uint64)
-TEXT ·mul(SB),0,$16-24
- MOVQ dest+0(FP), DI
- MOVQ a+8(FP), SI
- MOVQ b+16(FP), DX
-
- MOVQ DX,CX
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,0(SP)
- MULQ 16(CX)
- MOVQ AX,R8
- MOVQ DX,R9
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MOVQ AX,8(SP)
- MULQ 8(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 0(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 0(SI),AX
- MULQ 8(CX)
- MOVQ AX,R10
- MOVQ DX,R11
- MOVQ 0(SI),AX
- MULQ 16(CX)
- MOVQ AX,R12
- MOVQ DX,R13
- MOVQ 0(SI),AX
- MULQ 24(CX)
- MOVQ AX,R14
- MOVQ DX,R15
- MOVQ 0(SI),AX
- MULQ 32(CX)
- MOVQ AX,BX
- MOVQ DX,BP
- MOVQ 8(SI),AX
- MULQ 0(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SI),AX
- MULQ 8(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SI),AX
- MULQ 16(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 8(SI),AX
- MULQ 24(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 8(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),AX
- MULQ 0(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 16(SI),AX
- MULQ 8(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 16(SI),AX
- MULQ 16(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(CX)
- ADDQ AX,R8
- ADCQ DX,R9
- MOVQ 16(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 24(SI),AX
- MULQ 0(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ 24(SI),AX
- MULQ 8(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 0(SP),AX
- MULQ 24(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 0(SP),AX
- MULQ 32(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 32(SI),AX
- MULQ 0(CX)
- ADDQ AX,BX
- ADCQ DX,BP
- MOVQ 8(SP),AX
- MULQ 16(CX)
- ADDQ AX,R10
- ADCQ DX,R11
- MOVQ 8(SP),AX
- MULQ 24(CX)
- ADDQ AX,R12
- ADCQ DX,R13
- MOVQ 8(SP),AX
- MULQ 32(CX)
- ADDQ AX,R14
- ADCQ DX,R15
- MOVQ $REDMASK51,SI
- SHLQ $13,R8,R9
- ANDQ SI,R8
- SHLQ $13,R10,R11
- ANDQ SI,R10
- ADDQ R9,R10
- SHLQ $13,R12,R13
- ANDQ SI,R12
- ADDQ R11,R12
- SHLQ $13,R14,R15
- ANDQ SI,R14
- ADDQ R13,R14
- SHLQ $13,BX,BP
- ANDQ SI,BX
- ADDQ R15,BX
- IMUL3Q $19,BP,DX
- ADDQ DX,R8
- MOVQ R8,DX
- SHRQ $51,DX
- ADDQ R10,DX
- MOVQ DX,CX
- SHRQ $51,DX
- ANDQ SI,R8
- ADDQ R12,DX
- MOVQ DX,R9
- SHRQ $51,DX
- ANDQ SI,CX
- ADDQ R14,DX
- MOVQ DX,AX
- SHRQ $51,DX
- ANDQ SI,R9
- ADDQ BX,DX
- MOVQ DX,R10
- SHRQ $51,DX
- ANDQ SI,AX
- IMUL3Q $19,DX,DX
- ADDQ DX,R8
- ANDQ SI,R10
- MOVQ R8,0(DI)
- MOVQ CX,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- RET
-
-// func square(out, in *[5]uint64)
-TEXT ·square(SB),7,$0-16
- MOVQ out+0(FP), DI
- MOVQ in+8(FP), SI
-
- MOVQ 0(SI),AX
- MULQ 0(SI)
- MOVQ AX,CX
- MOVQ DX,R8
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 8(SI)
- MOVQ AX,R9
- MOVQ DX,R10
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- MOVQ AX,R11
- MOVQ DX,R12
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- MOVQ AX,R13
- MOVQ DX,R14
- MOVQ 0(SI),AX
- SHLQ $1,AX
- MULQ 32(SI)
- MOVQ AX,R15
- MOVQ DX,BX
- MOVQ 8(SI),AX
- MULQ 8(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 16(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ 8(SI),AX
- SHLQ $1,AX
- MULQ 24(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 8(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),AX
- MULQ 16(SI)
- ADDQ AX,R15
- ADCQ DX,BX
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 24(SI)
- ADDQ AX,CX
- ADCQ DX,R8
- MOVQ 16(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 24(SI)
- ADDQ AX,R9
- ADCQ DX,R10
- MOVQ 24(SI),DX
- IMUL3Q $38,DX,AX
- MULQ 32(SI)
- ADDQ AX,R11
- ADCQ DX,R12
- MOVQ 32(SI),DX
- IMUL3Q $19,DX,AX
- MULQ 32(SI)
- ADDQ AX,R13
- ADCQ DX,R14
- MOVQ $REDMASK51,SI
- SHLQ $13,CX,R8
- ANDQ SI,CX
- SHLQ $13,R9,R10
- ANDQ SI,R9
- ADDQ R8,R9
- SHLQ $13,R11,R12
- ANDQ SI,R11
- ADDQ R10,R11
- SHLQ $13,R13,R14
- ANDQ SI,R13
- ADDQ R12,R13
- SHLQ $13,R15,BX
- ANDQ SI,R15
- ADDQ R14,R15
- IMUL3Q $19,BX,DX
- ADDQ DX,CX
- MOVQ CX,DX
- SHRQ $51,DX
- ADDQ R9,DX
- ANDQ SI,CX
- MOVQ DX,R8
- SHRQ $51,DX
- ADDQ R11,DX
- ANDQ SI,R8
- MOVQ DX,R9
- SHRQ $51,DX
- ADDQ R13,DX
- ANDQ SI,R9
- MOVQ DX,AX
- SHRQ $51,DX
- ADDQ R15,DX
- ANDQ SI,AX
- MOVQ DX,R10
- SHRQ $51,DX
- IMUL3Q $19,DX,DX
- ADDQ DX,CX
- ANDQ SI,R10
- MOVQ CX,0(DI)
- MOVQ R8,8(DI)
- MOVQ R9,16(DI)
- MOVQ AX,24(DI)
- MOVQ R10,32(DI)
- RET
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_generic.go b/vendor/golang.org/x/crypto/curve25519/curve25519_generic.go
deleted file mode 100644
index c43b13fc83..0000000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519_generic.go
+++ /dev/null
@@ -1,828 +0,0 @@
-// Copyright 2013 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package curve25519
-
-import "encoding/binary"
-
-// This code is a port of the public domain, "ref10" implementation of
-// curve25519 from SUPERCOP 20130419 by D. J. Bernstein.
-
-// fieldElement represents an element of the field GF(2^255 - 19). An element
-// t, entries t[0]...t[9], represents the integer t[0]+2^26 t[1]+2^51 t[2]+2^77
-// t[3]+2^102 t[4]+...+2^230 t[9]. Bounds on each t[i] vary depending on
-// context.
-type fieldElement [10]int32
-
-func feZero(fe *fieldElement) {
- for i := range fe {
- fe[i] = 0
- }
-}
-
-func feOne(fe *fieldElement) {
- feZero(fe)
- fe[0] = 1
-}
-
-func feAdd(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] + b[i]
- }
-}
-
-func feSub(dst, a, b *fieldElement) {
- for i := range dst {
- dst[i] = a[i] - b[i]
- }
-}
-
-func feCopy(dst, src *fieldElement) {
- for i := range dst {
- dst[i] = src[i]
- }
-}
-
-// feCSwap replaces (f,g) with (g,f) if b == 1; replaces (f,g) with (f,g) if b == 0.
-//
-// Preconditions: b in {0,1}.
-func feCSwap(f, g *fieldElement, b int32) {
- b = -b
- for i := range f {
- t := b & (f[i] ^ g[i])
- f[i] ^= t
- g[i] ^= t
- }
-}
-
-// load3 reads a 24-bit, little-endian value from in.
-func load3(in []byte) int64 {
- var r int64
- r = int64(in[0])
- r |= int64(in[1]) << 8
- r |= int64(in[2]) << 16
- return r
-}
-
-// load4 reads a 32-bit, little-endian value from in.
-func load4(in []byte) int64 {
- return int64(binary.LittleEndian.Uint32(in))
-}
-
-func feFromBytes(dst *fieldElement, src *[32]byte) {
- h0 := load4(src[:])
- h1 := load3(src[4:]) << 6
- h2 := load3(src[7:]) << 5
- h3 := load3(src[10:]) << 3
- h4 := load3(src[13:]) << 2
- h5 := load4(src[16:])
- h6 := load3(src[20:]) << 7
- h7 := load3(src[23:]) << 5
- h8 := load3(src[26:]) << 4
- h9 := (load3(src[29:]) & 0x7fffff) << 2
-
- var carry [10]int64
- carry[9] = (h9 + 1<<24) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + 1<<24) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + 1<<24) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + 1<<24) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + 1<<24) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + 1<<25) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + 1<<25) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + 1<<25) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + 1<<25) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + 1<<25) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- dst[0] = int32(h0)
- dst[1] = int32(h1)
- dst[2] = int32(h2)
- dst[3] = int32(h3)
- dst[4] = int32(h4)
- dst[5] = int32(h5)
- dst[6] = int32(h6)
- dst[7] = int32(h7)
- dst[8] = int32(h8)
- dst[9] = int32(h9)
-}
-
-// feToBytes marshals h to s.
-// Preconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Write p=2^255-19; q=floor(h/p).
-// Basic claim: q = floor(2^(-255)(h + 19 2^(-25)h9 + 2^(-1))).
-//
-// Proof:
-// Have |h|<=p so |q|<=1 so |19^2 2^(-255) q|<1/4.
-// Also have |h-2^230 h9|<2^230 so |19 2^(-255)(h-2^230 h9)|<1/4.
-//
-// Write y=2^(-1)-19^2 2^(-255)q-19 2^(-255)(h-2^230 h9).
-// Then 0> 25
- q = (h[0] + q) >> 26
- q = (h[1] + q) >> 25
- q = (h[2] + q) >> 26
- q = (h[3] + q) >> 25
- q = (h[4] + q) >> 26
- q = (h[5] + q) >> 25
- q = (h[6] + q) >> 26
- q = (h[7] + q) >> 25
- q = (h[8] + q) >> 26
- q = (h[9] + q) >> 25
-
- // Goal: Output h-(2^255-19)q, which is between 0 and 2^255-20.
- h[0] += 19 * q
- // Goal: Output h-2^255 q, which is between 0 and 2^255-20.
-
- carry[0] = h[0] >> 26
- h[1] += carry[0]
- h[0] -= carry[0] << 26
- carry[1] = h[1] >> 25
- h[2] += carry[1]
- h[1] -= carry[1] << 25
- carry[2] = h[2] >> 26
- h[3] += carry[2]
- h[2] -= carry[2] << 26
- carry[3] = h[3] >> 25
- h[4] += carry[3]
- h[3] -= carry[3] << 25
- carry[4] = h[4] >> 26
- h[5] += carry[4]
- h[4] -= carry[4] << 26
- carry[5] = h[5] >> 25
- h[6] += carry[5]
- h[5] -= carry[5] << 25
- carry[6] = h[6] >> 26
- h[7] += carry[6]
- h[6] -= carry[6] << 26
- carry[7] = h[7] >> 25
- h[8] += carry[7]
- h[7] -= carry[7] << 25
- carry[8] = h[8] >> 26
- h[9] += carry[8]
- h[8] -= carry[8] << 26
- carry[9] = h[9] >> 25
- h[9] -= carry[9] << 25
- // h10 = carry9
-
- // Goal: Output h[0]+...+2^255 h10-2^255 q, which is between 0 and 2^255-20.
- // Have h[0]+...+2^230 h[9] between 0 and 2^255-1;
- // evidently 2^255 h10-2^255 q = 0.
- // Goal: Output h[0]+...+2^230 h[9].
-
- s[0] = byte(h[0] >> 0)
- s[1] = byte(h[0] >> 8)
- s[2] = byte(h[0] >> 16)
- s[3] = byte((h[0] >> 24) | (h[1] << 2))
- s[4] = byte(h[1] >> 6)
- s[5] = byte(h[1] >> 14)
- s[6] = byte((h[1] >> 22) | (h[2] << 3))
- s[7] = byte(h[2] >> 5)
- s[8] = byte(h[2] >> 13)
- s[9] = byte((h[2] >> 21) | (h[3] << 5))
- s[10] = byte(h[3] >> 3)
- s[11] = byte(h[3] >> 11)
- s[12] = byte((h[3] >> 19) | (h[4] << 6))
- s[13] = byte(h[4] >> 2)
- s[14] = byte(h[4] >> 10)
- s[15] = byte(h[4] >> 18)
- s[16] = byte(h[5] >> 0)
- s[17] = byte(h[5] >> 8)
- s[18] = byte(h[5] >> 16)
- s[19] = byte((h[5] >> 24) | (h[6] << 1))
- s[20] = byte(h[6] >> 7)
- s[21] = byte(h[6] >> 15)
- s[22] = byte((h[6] >> 23) | (h[7] << 3))
- s[23] = byte(h[7] >> 5)
- s[24] = byte(h[7] >> 13)
- s[25] = byte((h[7] >> 21) | (h[8] << 4))
- s[26] = byte(h[8] >> 4)
- s[27] = byte(h[8] >> 12)
- s[28] = byte((h[8] >> 20) | (h[9] << 6))
- s[29] = byte(h[9] >> 2)
- s[30] = byte(h[9] >> 10)
- s[31] = byte(h[9] >> 18)
-}
-
-// feMul calculates h = f * g
-// Can overlap h with f or g.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-// |g| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-//
-// Notes on implementation strategy:
-//
-// Using schoolbook multiplication.
-// Karatsuba would save a little in some cost models.
-//
-// Most multiplications by 2 and 19 are 32-bit precomputations;
-// cheaper than 64-bit postcomputations.
-//
-// There is one remaining multiplication by 19 in the carry chain;
-// one *19 precomputation can be merged into this,
-// but the resulting data flow is considerably less clean.
-//
-// There are 12 carries below.
-// 10 of them are 2-way parallelizable and vectorizable.
-// Can get away with 11 carries, but then data flow is much deeper.
-//
-// With tighter constraints on inputs can squeeze carries into int32.
-func feMul(h, f, g *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- g0 := g[0]
- g1 := g[1]
- g2 := g[2]
- g3 := g[3]
- g4 := g[4]
- g5 := g[5]
- g6 := g[6]
- g7 := g[7]
- g8 := g[8]
- g9 := g[9]
- g1_19 := 19 * g1 // 1.4*2^29
- g2_19 := 19 * g2 // 1.4*2^30; still ok
- g3_19 := 19 * g3
- g4_19 := 19 * g4
- g5_19 := 19 * g5
- g6_19 := 19 * g6
- g7_19 := 19 * g7
- g8_19 := 19 * g8
- g9_19 := 19 * g9
- f1_2 := 2 * f1
- f3_2 := 2 * f3
- f5_2 := 2 * f5
- f7_2 := 2 * f7
- f9_2 := 2 * f9
- f0g0 := int64(f0) * int64(g0)
- f0g1 := int64(f0) * int64(g1)
- f0g2 := int64(f0) * int64(g2)
- f0g3 := int64(f0) * int64(g3)
- f0g4 := int64(f0) * int64(g4)
- f0g5 := int64(f0) * int64(g5)
- f0g6 := int64(f0) * int64(g6)
- f0g7 := int64(f0) * int64(g7)
- f0g8 := int64(f0) * int64(g8)
- f0g9 := int64(f0) * int64(g9)
- f1g0 := int64(f1) * int64(g0)
- f1g1_2 := int64(f1_2) * int64(g1)
- f1g2 := int64(f1) * int64(g2)
- f1g3_2 := int64(f1_2) * int64(g3)
- f1g4 := int64(f1) * int64(g4)
- f1g5_2 := int64(f1_2) * int64(g5)
- f1g6 := int64(f1) * int64(g6)
- f1g7_2 := int64(f1_2) * int64(g7)
- f1g8 := int64(f1) * int64(g8)
- f1g9_38 := int64(f1_2) * int64(g9_19)
- f2g0 := int64(f2) * int64(g0)
- f2g1 := int64(f2) * int64(g1)
- f2g2 := int64(f2) * int64(g2)
- f2g3 := int64(f2) * int64(g3)
- f2g4 := int64(f2) * int64(g4)
- f2g5 := int64(f2) * int64(g5)
- f2g6 := int64(f2) * int64(g6)
- f2g7 := int64(f2) * int64(g7)
- f2g8_19 := int64(f2) * int64(g8_19)
- f2g9_19 := int64(f2) * int64(g9_19)
- f3g0 := int64(f3) * int64(g0)
- f3g1_2 := int64(f3_2) * int64(g1)
- f3g2 := int64(f3) * int64(g2)
- f3g3_2 := int64(f3_2) * int64(g3)
- f3g4 := int64(f3) * int64(g4)
- f3g5_2 := int64(f3_2) * int64(g5)
- f3g6 := int64(f3) * int64(g6)
- f3g7_38 := int64(f3_2) * int64(g7_19)
- f3g8_19 := int64(f3) * int64(g8_19)
- f3g9_38 := int64(f3_2) * int64(g9_19)
- f4g0 := int64(f4) * int64(g0)
- f4g1 := int64(f4) * int64(g1)
- f4g2 := int64(f4) * int64(g2)
- f4g3 := int64(f4) * int64(g3)
- f4g4 := int64(f4) * int64(g4)
- f4g5 := int64(f4) * int64(g5)
- f4g6_19 := int64(f4) * int64(g6_19)
- f4g7_19 := int64(f4) * int64(g7_19)
- f4g8_19 := int64(f4) * int64(g8_19)
- f4g9_19 := int64(f4) * int64(g9_19)
- f5g0 := int64(f5) * int64(g0)
- f5g1_2 := int64(f5_2) * int64(g1)
- f5g2 := int64(f5) * int64(g2)
- f5g3_2 := int64(f5_2) * int64(g3)
- f5g4 := int64(f5) * int64(g4)
- f5g5_38 := int64(f5_2) * int64(g5_19)
- f5g6_19 := int64(f5) * int64(g6_19)
- f5g7_38 := int64(f5_2) * int64(g7_19)
- f5g8_19 := int64(f5) * int64(g8_19)
- f5g9_38 := int64(f5_2) * int64(g9_19)
- f6g0 := int64(f6) * int64(g0)
- f6g1 := int64(f6) * int64(g1)
- f6g2 := int64(f6) * int64(g2)
- f6g3 := int64(f6) * int64(g3)
- f6g4_19 := int64(f6) * int64(g4_19)
- f6g5_19 := int64(f6) * int64(g5_19)
- f6g6_19 := int64(f6) * int64(g6_19)
- f6g7_19 := int64(f6) * int64(g7_19)
- f6g8_19 := int64(f6) * int64(g8_19)
- f6g9_19 := int64(f6) * int64(g9_19)
- f7g0 := int64(f7) * int64(g0)
- f7g1_2 := int64(f7_2) * int64(g1)
- f7g2 := int64(f7) * int64(g2)
- f7g3_38 := int64(f7_2) * int64(g3_19)
- f7g4_19 := int64(f7) * int64(g4_19)
- f7g5_38 := int64(f7_2) * int64(g5_19)
- f7g6_19 := int64(f7) * int64(g6_19)
- f7g7_38 := int64(f7_2) * int64(g7_19)
- f7g8_19 := int64(f7) * int64(g8_19)
- f7g9_38 := int64(f7_2) * int64(g9_19)
- f8g0 := int64(f8) * int64(g0)
- f8g1 := int64(f8) * int64(g1)
- f8g2_19 := int64(f8) * int64(g2_19)
- f8g3_19 := int64(f8) * int64(g3_19)
- f8g4_19 := int64(f8) * int64(g4_19)
- f8g5_19 := int64(f8) * int64(g5_19)
- f8g6_19 := int64(f8) * int64(g6_19)
- f8g7_19 := int64(f8) * int64(g7_19)
- f8g8_19 := int64(f8) * int64(g8_19)
- f8g9_19 := int64(f8) * int64(g9_19)
- f9g0 := int64(f9) * int64(g0)
- f9g1_38 := int64(f9_2) * int64(g1_19)
- f9g2_19 := int64(f9) * int64(g2_19)
- f9g3_38 := int64(f9_2) * int64(g3_19)
- f9g4_19 := int64(f9) * int64(g4_19)
- f9g5_38 := int64(f9_2) * int64(g5_19)
- f9g6_19 := int64(f9) * int64(g6_19)
- f9g7_38 := int64(f9_2) * int64(g7_19)
- f9g8_19 := int64(f9) * int64(g8_19)
- f9g9_38 := int64(f9_2) * int64(g9_19)
- h0 := f0g0 + f1g9_38 + f2g8_19 + f3g7_38 + f4g6_19 + f5g5_38 + f6g4_19 + f7g3_38 + f8g2_19 + f9g1_38
- h1 := f0g1 + f1g0 + f2g9_19 + f3g8_19 + f4g7_19 + f5g6_19 + f6g5_19 + f7g4_19 + f8g3_19 + f9g2_19
- h2 := f0g2 + f1g1_2 + f2g0 + f3g9_38 + f4g8_19 + f5g7_38 + f6g6_19 + f7g5_38 + f8g4_19 + f9g3_38
- h3 := f0g3 + f1g2 + f2g1 + f3g0 + f4g9_19 + f5g8_19 + f6g7_19 + f7g6_19 + f8g5_19 + f9g4_19
- h4 := f0g4 + f1g3_2 + f2g2 + f3g1_2 + f4g0 + f5g9_38 + f6g8_19 + f7g7_38 + f8g6_19 + f9g5_38
- h5 := f0g5 + f1g4 + f2g3 + f3g2 + f4g1 + f5g0 + f6g9_19 + f7g8_19 + f8g7_19 + f9g6_19
- h6 := f0g6 + f1g5_2 + f2g4 + f3g3_2 + f4g2 + f5g1_2 + f6g0 + f7g9_38 + f8g8_19 + f9g7_38
- h7 := f0g7 + f1g6 + f2g5 + f3g4 + f4g3 + f5g2 + f6g1 + f7g0 + f8g9_19 + f9g8_19
- h8 := f0g8 + f1g7_2 + f2g6 + f3g5_2 + f4g4 + f5g3_2 + f6g2 + f7g1_2 + f8g0 + f9g9_38
- h9 := f0g9 + f1g8 + f2g7 + f3g6 + f4g5 + f5g4 + f6g3 + f7g2 + f8g1 + f9g0
- var carry [10]int64
-
- // |h0| <= (1.1*1.1*2^52*(1+19+19+19+19)+1.1*1.1*2^50*(38+38+38+38+38))
- // i.e. |h0| <= 1.2*2^59; narrower ranges for h2, h4, h6, h8
- // |h1| <= (1.1*1.1*2^51*(1+1+19+19+19+19+19+19+19+19))
- // i.e. |h1| <= 1.5*2^58; narrower ranges for h3, h5, h7, h9
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- // |h0| <= 2^25
- // |h4| <= 2^25
- // |h1| <= 1.51*2^58
- // |h5| <= 1.51*2^58
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- // |h1| <= 2^24; from now on fits into int32
- // |h5| <= 2^24; from now on fits into int32
- // |h2| <= 1.21*2^59
- // |h6| <= 1.21*2^59
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- // |h2| <= 2^25; from now on fits into int32 unchanged
- // |h6| <= 2^25; from now on fits into int32 unchanged
- // |h3| <= 1.51*2^58
- // |h7| <= 1.51*2^58
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
- // |h3| <= 2^24; from now on fits into int32 unchanged
- // |h7| <= 2^24; from now on fits into int32 unchanged
- // |h4| <= 1.52*2^33
- // |h8| <= 1.52*2^33
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
- // |h4| <= 2^25; from now on fits into int32 unchanged
- // |h8| <= 2^25; from now on fits into int32 unchanged
- // |h5| <= 1.01*2^24
- // |h9| <= 1.51*2^58
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- // |h9| <= 2^24; from now on fits into int32 unchanged
- // |h0| <= 1.8*2^37
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- // |h0| <= 2^25; from now on fits into int32 unchanged
- // |h1| <= 1.01*2^24
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feSquare calculates h = f*f. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feSquare(h, f *fieldElement) {
- f0 := f[0]
- f1 := f[1]
- f2 := f[2]
- f3 := f[3]
- f4 := f[4]
- f5 := f[5]
- f6 := f[6]
- f7 := f[7]
- f8 := f[8]
- f9 := f[9]
- f0_2 := 2 * f0
- f1_2 := 2 * f1
- f2_2 := 2 * f2
- f3_2 := 2 * f3
- f4_2 := 2 * f4
- f5_2 := 2 * f5
- f6_2 := 2 * f6
- f7_2 := 2 * f7
- f5_38 := 38 * f5 // 1.31*2^30
- f6_19 := 19 * f6 // 1.31*2^30
- f7_38 := 38 * f7 // 1.31*2^30
- f8_19 := 19 * f8 // 1.31*2^30
- f9_38 := 38 * f9 // 1.31*2^30
- f0f0 := int64(f0) * int64(f0)
- f0f1_2 := int64(f0_2) * int64(f1)
- f0f2_2 := int64(f0_2) * int64(f2)
- f0f3_2 := int64(f0_2) * int64(f3)
- f0f4_2 := int64(f0_2) * int64(f4)
- f0f5_2 := int64(f0_2) * int64(f5)
- f0f6_2 := int64(f0_2) * int64(f6)
- f0f7_2 := int64(f0_2) * int64(f7)
- f0f8_2 := int64(f0_2) * int64(f8)
- f0f9_2 := int64(f0_2) * int64(f9)
- f1f1_2 := int64(f1_2) * int64(f1)
- f1f2_2 := int64(f1_2) * int64(f2)
- f1f3_4 := int64(f1_2) * int64(f3_2)
- f1f4_2 := int64(f1_2) * int64(f4)
- f1f5_4 := int64(f1_2) * int64(f5_2)
- f1f6_2 := int64(f1_2) * int64(f6)
- f1f7_4 := int64(f1_2) * int64(f7_2)
- f1f8_2 := int64(f1_2) * int64(f8)
- f1f9_76 := int64(f1_2) * int64(f9_38)
- f2f2 := int64(f2) * int64(f2)
- f2f3_2 := int64(f2_2) * int64(f3)
- f2f4_2 := int64(f2_2) * int64(f4)
- f2f5_2 := int64(f2_2) * int64(f5)
- f2f6_2 := int64(f2_2) * int64(f6)
- f2f7_2 := int64(f2_2) * int64(f7)
- f2f8_38 := int64(f2_2) * int64(f8_19)
- f2f9_38 := int64(f2) * int64(f9_38)
- f3f3_2 := int64(f3_2) * int64(f3)
- f3f4_2 := int64(f3_2) * int64(f4)
- f3f5_4 := int64(f3_2) * int64(f5_2)
- f3f6_2 := int64(f3_2) * int64(f6)
- f3f7_76 := int64(f3_2) * int64(f7_38)
- f3f8_38 := int64(f3_2) * int64(f8_19)
- f3f9_76 := int64(f3_2) * int64(f9_38)
- f4f4 := int64(f4) * int64(f4)
- f4f5_2 := int64(f4_2) * int64(f5)
- f4f6_38 := int64(f4_2) * int64(f6_19)
- f4f7_38 := int64(f4) * int64(f7_38)
- f4f8_38 := int64(f4_2) * int64(f8_19)
- f4f9_38 := int64(f4) * int64(f9_38)
- f5f5_38 := int64(f5) * int64(f5_38)
- f5f6_38 := int64(f5_2) * int64(f6_19)
- f5f7_76 := int64(f5_2) * int64(f7_38)
- f5f8_38 := int64(f5_2) * int64(f8_19)
- f5f9_76 := int64(f5_2) * int64(f9_38)
- f6f6_19 := int64(f6) * int64(f6_19)
- f6f7_38 := int64(f6) * int64(f7_38)
- f6f8_38 := int64(f6_2) * int64(f8_19)
- f6f9_38 := int64(f6) * int64(f9_38)
- f7f7_38 := int64(f7) * int64(f7_38)
- f7f8_38 := int64(f7_2) * int64(f8_19)
- f7f9_76 := int64(f7_2) * int64(f9_38)
- f8f8_19 := int64(f8) * int64(f8_19)
- f8f9_38 := int64(f8) * int64(f9_38)
- f9f9_38 := int64(f9) * int64(f9_38)
- h0 := f0f0 + f1f9_76 + f2f8_38 + f3f7_76 + f4f6_38 + f5f5_38
- h1 := f0f1_2 + f2f9_38 + f3f8_38 + f4f7_38 + f5f6_38
- h2 := f0f2_2 + f1f1_2 + f3f9_76 + f4f8_38 + f5f7_76 + f6f6_19
- h3 := f0f3_2 + f1f2_2 + f4f9_38 + f5f8_38 + f6f7_38
- h4 := f0f4_2 + f1f3_4 + f2f2 + f5f9_76 + f6f8_38 + f7f7_38
- h5 := f0f5_2 + f1f4_2 + f2f3_2 + f6f9_38 + f7f8_38
- h6 := f0f6_2 + f1f5_4 + f2f4_2 + f3f3_2 + f7f9_76 + f8f8_19
- h7 := f0f7_2 + f1f6_2 + f2f5_2 + f3f4_2 + f8f9_38
- h8 := f0f8_2 + f1f7_4 + f2f6_2 + f3f5_4 + f4f4 + f9f9_38
- h9 := f0f9_2 + f1f8_2 + f2f7_2 + f3f6_2 + f4f5_2
- var carry [10]int64
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
-
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
-
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
-
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feMul121666 calculates h = f * 121666. Can overlap h with f.
-//
-// Preconditions:
-// |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
-//
-// Postconditions:
-// |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
-func feMul121666(h, f *fieldElement) {
- h0 := int64(f[0]) * 121666
- h1 := int64(f[1]) * 121666
- h2 := int64(f[2]) * 121666
- h3 := int64(f[3]) * 121666
- h4 := int64(f[4]) * 121666
- h5 := int64(f[5]) * 121666
- h6 := int64(f[6]) * 121666
- h7 := int64(f[7]) * 121666
- h8 := int64(f[8]) * 121666
- h9 := int64(f[9]) * 121666
- var carry [10]int64
-
- carry[9] = (h9 + (1 << 24)) >> 25
- h0 += carry[9] * 19
- h9 -= carry[9] << 25
- carry[1] = (h1 + (1 << 24)) >> 25
- h2 += carry[1]
- h1 -= carry[1] << 25
- carry[3] = (h3 + (1 << 24)) >> 25
- h4 += carry[3]
- h3 -= carry[3] << 25
- carry[5] = (h5 + (1 << 24)) >> 25
- h6 += carry[5]
- h5 -= carry[5] << 25
- carry[7] = (h7 + (1 << 24)) >> 25
- h8 += carry[7]
- h7 -= carry[7] << 25
-
- carry[0] = (h0 + (1 << 25)) >> 26
- h1 += carry[0]
- h0 -= carry[0] << 26
- carry[2] = (h2 + (1 << 25)) >> 26
- h3 += carry[2]
- h2 -= carry[2] << 26
- carry[4] = (h4 + (1 << 25)) >> 26
- h5 += carry[4]
- h4 -= carry[4] << 26
- carry[6] = (h6 + (1 << 25)) >> 26
- h7 += carry[6]
- h6 -= carry[6] << 26
- carry[8] = (h8 + (1 << 25)) >> 26
- h9 += carry[8]
- h8 -= carry[8] << 26
-
- h[0] = int32(h0)
- h[1] = int32(h1)
- h[2] = int32(h2)
- h[3] = int32(h3)
- h[4] = int32(h4)
- h[5] = int32(h5)
- h[6] = int32(h6)
- h[7] = int32(h7)
- h[8] = int32(h8)
- h[9] = int32(h9)
-}
-
-// feInvert sets out = z^-1.
-func feInvert(out, z *fieldElement) {
- var t0, t1, t2, t3 fieldElement
- var i int
-
- feSquare(&t0, z)
- for i = 1; i < 1; i++ {
- feSquare(&t0, &t0)
- }
- feSquare(&t1, &t0)
- for i = 1; i < 2; i++ {
- feSquare(&t1, &t1)
- }
- feMul(&t1, z, &t1)
- feMul(&t0, &t0, &t1)
- feSquare(&t2, &t0)
- for i = 1; i < 1; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t1, &t2)
- feSquare(&t2, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 20; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 10; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t2, &t1)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t2, &t2, &t1)
- feSquare(&t3, &t2)
- for i = 1; i < 100; i++ {
- feSquare(&t3, &t3)
- }
- feMul(&t2, &t3, &t2)
- feSquare(&t2, &t2)
- for i = 1; i < 50; i++ {
- feSquare(&t2, &t2)
- }
- feMul(&t1, &t2, &t1)
- feSquare(&t1, &t1)
- for i = 1; i < 5; i++ {
- feSquare(&t1, &t1)
- }
- feMul(out, &t1, &t0)
-}
-
-func scalarMultGeneric(out, in, base *[32]byte) {
- var e [32]byte
-
- copy(e[:], in[:])
- e[0] &= 248
- e[31] &= 127
- e[31] |= 64
-
- var x1, x2, z2, x3, z3, tmp0, tmp1 fieldElement
- feFromBytes(&x1, base)
- feOne(&x2)
- feCopy(&x3, &x1)
- feOne(&z3)
-
- swap := int32(0)
- for pos := 254; pos >= 0; pos-- {
- b := e[pos/8] >> uint(pos&7)
- b &= 1
- swap ^= int32(b)
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
- swap = int32(b)
-
- feSub(&tmp0, &x3, &z3)
- feSub(&tmp1, &x2, &z2)
- feAdd(&x2, &x2, &z2)
- feAdd(&z2, &x3, &z3)
- feMul(&z3, &tmp0, &x2)
- feMul(&z2, &z2, &tmp1)
- feSquare(&tmp0, &tmp1)
- feSquare(&tmp1, &x2)
- feAdd(&x3, &z3, &z2)
- feSub(&z2, &z3, &z2)
- feMul(&x2, &tmp1, &tmp0)
- feSub(&tmp1, &tmp1, &tmp0)
- feSquare(&z2, &z2)
- feMul121666(&z3, &tmp1)
- feSquare(&x3, &x3)
- feAdd(&tmp0, &tmp0, &z3)
- feMul(&z3, &x1, &z2)
- feMul(&z2, &tmp1, &tmp0)
- }
-
- feCSwap(&x2, &x3, swap)
- feCSwap(&z2, &z3, swap)
-
- feInvert(&z2, &z2)
- feMul(&x2, &x2, &z2)
- feToBytes(out, &x2)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/curve25519_noasm.go b/vendor/golang.org/x/crypto/curve25519/curve25519_noasm.go
deleted file mode 100644
index 259728af7d..0000000000
--- a/vendor/golang.org/x/crypto/curve25519/curve25519_noasm.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2019 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:build !amd64 || !gc || purego
-// +build !amd64 !gc purego
-
-package curve25519
-
-func scalarMult(out, in, base *[32]byte) {
- scalarMultGeneric(out, in, base)
-}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/README b/vendor/golang.org/x/crypto/curve25519/internal/field/README
new file mode 100644
index 0000000000..e25bca7dc8
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/README
@@ -0,0 +1,7 @@
+This package is kept in sync with crypto/ed25519/internal/edwards25519/field in
+the standard library.
+
+If there are any changes in the standard library that need to be synced to this
+package, run sync.sh. It will not overwrite any local changes made since the
+previous sync, so it's ok to land changes in this package first, and then sync
+to the standard library later.
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go
new file mode 100644
index 0000000000..ca841ad99e
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe.go
@@ -0,0 +1,416 @@
+// Copyright (c) 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package field implements fast arithmetic modulo 2^255-19.
+package field
+
+import (
+ "crypto/subtle"
+ "encoding/binary"
+ "math/bits"
+)
+
+// Element represents an element of the field GF(2^255-19). Note that this
+// is not a cryptographically secure group, and should only be used to interact
+// with edwards25519.Point coordinates.
+//
+// This type works similarly to math/big.Int, and all arguments and receivers
+// are allowed to alias.
+//
+// The zero value is a valid zero element.
+type Element struct {
+ // An element t represents the integer
+ // t.l0 + t.l1*2^51 + t.l2*2^102 + t.l3*2^153 + t.l4*2^204
+ //
+ // Between operations, all limbs are expected to be lower than 2^52.
+ l0 uint64
+ l1 uint64
+ l2 uint64
+ l3 uint64
+ l4 uint64
+}
+
+const maskLow51Bits uint64 = (1 << 51) - 1
+
+var feZero = &Element{0, 0, 0, 0, 0}
+
+// Zero sets v = 0, and returns v.
+func (v *Element) Zero() *Element {
+ *v = *feZero
+ return v
+}
+
+var feOne = &Element{1, 0, 0, 0, 0}
+
+// One sets v = 1, and returns v.
+func (v *Element) One() *Element {
+ *v = *feOne
+ return v
+}
+
+// reduce reduces v modulo 2^255 - 19 and returns it.
+func (v *Element) reduce() *Element {
+ v.carryPropagate()
+
+ // After the light reduction we now have a field element representation
+ // v < 2^255 + 2^13 * 19, but need v < 2^255 - 19.
+
+ // If v >= 2^255 - 19, then v + 19 >= 2^255, which would overflow 2^255 - 1,
+ // generating a carry. That is, c will be 0 if v < 2^255 - 19, and 1 otherwise.
+ c := (v.l0 + 19) >> 51
+ c = (v.l1 + c) >> 51
+ c = (v.l2 + c) >> 51
+ c = (v.l3 + c) >> 51
+ c = (v.l4 + c) >> 51
+
+ // If v < 2^255 - 19 and c = 0, this will be a no-op. Otherwise, it's
+ // effectively applying the reduction identity to the carry.
+ v.l0 += 19 * c
+
+ v.l1 += v.l0 >> 51
+ v.l0 = v.l0 & maskLow51Bits
+ v.l2 += v.l1 >> 51
+ v.l1 = v.l1 & maskLow51Bits
+ v.l3 += v.l2 >> 51
+ v.l2 = v.l2 & maskLow51Bits
+ v.l4 += v.l3 >> 51
+ v.l3 = v.l3 & maskLow51Bits
+ // no additional carry
+ v.l4 = v.l4 & maskLow51Bits
+
+ return v
+}
+
+// Add sets v = a + b, and returns v.
+func (v *Element) Add(a, b *Element) *Element {
+ v.l0 = a.l0 + b.l0
+ v.l1 = a.l1 + b.l1
+ v.l2 = a.l2 + b.l2
+ v.l3 = a.l3 + b.l3
+ v.l4 = a.l4 + b.l4
+ // Using the generic implementation here is actually faster than the
+ // assembly. Probably because the body of this function is so simple that
+ // the compiler can figure out better optimizations by inlining the carry
+ // propagation. TODO
+ return v.carryPropagateGeneric()
+}
+
+// Subtract sets v = a - b, and returns v.
+func (v *Element) Subtract(a, b *Element) *Element {
+ // We first add 2 * p, to guarantee the subtraction won't underflow, and
+ // then subtract b (which can be up to 2^255 + 2^13 * 19).
+ v.l0 = (a.l0 + 0xFFFFFFFFFFFDA) - b.l0
+ v.l1 = (a.l1 + 0xFFFFFFFFFFFFE) - b.l1
+ v.l2 = (a.l2 + 0xFFFFFFFFFFFFE) - b.l2
+ v.l3 = (a.l3 + 0xFFFFFFFFFFFFE) - b.l3
+ v.l4 = (a.l4 + 0xFFFFFFFFFFFFE) - b.l4
+ return v.carryPropagate()
+}
+
+// Negate sets v = -a, and returns v.
+func (v *Element) Negate(a *Element) *Element {
+ return v.Subtract(feZero, a)
+}
+
+// Invert sets v = 1/z mod p, and returns v.
+//
+// If z == 0, Invert returns v = 0.
+func (v *Element) Invert(z *Element) *Element {
+ // Inversion is implemented as exponentiation with exponent p − 2. It uses the
+ // same sequence of 255 squarings and 11 multiplications as [Curve25519].
+ var z2, z9, z11, z2_5_0, z2_10_0, z2_20_0, z2_50_0, z2_100_0, t Element
+
+ z2.Square(z) // 2
+ t.Square(&z2) // 4
+ t.Square(&t) // 8
+ z9.Multiply(&t, z) // 9
+ z11.Multiply(&z9, &z2) // 11
+ t.Square(&z11) // 22
+ z2_5_0.Multiply(&t, &z9) // 31 = 2^5 - 2^0
+
+ t.Square(&z2_5_0) // 2^6 - 2^1
+ for i := 0; i < 4; i++ {
+ t.Square(&t) // 2^10 - 2^5
+ }
+ z2_10_0.Multiply(&t, &z2_5_0) // 2^10 - 2^0
+
+ t.Square(&z2_10_0) // 2^11 - 2^1
+ for i := 0; i < 9; i++ {
+ t.Square(&t) // 2^20 - 2^10
+ }
+ z2_20_0.Multiply(&t, &z2_10_0) // 2^20 - 2^0
+
+ t.Square(&z2_20_0) // 2^21 - 2^1
+ for i := 0; i < 19; i++ {
+ t.Square(&t) // 2^40 - 2^20
+ }
+ t.Multiply(&t, &z2_20_0) // 2^40 - 2^0
+
+ t.Square(&t) // 2^41 - 2^1
+ for i := 0; i < 9; i++ {
+ t.Square(&t) // 2^50 - 2^10
+ }
+ z2_50_0.Multiply(&t, &z2_10_0) // 2^50 - 2^0
+
+ t.Square(&z2_50_0) // 2^51 - 2^1
+ for i := 0; i < 49; i++ {
+ t.Square(&t) // 2^100 - 2^50
+ }
+ z2_100_0.Multiply(&t, &z2_50_0) // 2^100 - 2^0
+
+ t.Square(&z2_100_0) // 2^101 - 2^1
+ for i := 0; i < 99; i++ {
+ t.Square(&t) // 2^200 - 2^100
+ }
+ t.Multiply(&t, &z2_100_0) // 2^200 - 2^0
+
+ t.Square(&t) // 2^201 - 2^1
+ for i := 0; i < 49; i++ {
+ t.Square(&t) // 2^250 - 2^50
+ }
+ t.Multiply(&t, &z2_50_0) // 2^250 - 2^0
+
+ t.Square(&t) // 2^251 - 2^1
+ t.Square(&t) // 2^252 - 2^2
+ t.Square(&t) // 2^253 - 2^3
+ t.Square(&t) // 2^254 - 2^4
+ t.Square(&t) // 2^255 - 2^5
+
+ return v.Multiply(&t, &z11) // 2^255 - 21
+}
+
+// Set sets v = a, and returns v.
+func (v *Element) Set(a *Element) *Element {
+ *v = *a
+ return v
+}
+
+// SetBytes sets v to x, which must be a 32-byte little-endian encoding.
+//
+// Consistent with RFC 7748, the most significant bit (the high bit of the
+// last byte) is ignored, and non-canonical values (2^255-19 through 2^255-1)
+// are accepted. Note that this is laxer than specified by RFC 8032.
+func (v *Element) SetBytes(x []byte) *Element {
+ if len(x) != 32 {
+ panic("edwards25519: invalid field element input size")
+ }
+
+ // Bits 0:51 (bytes 0:8, bits 0:64, shift 0, mask 51).
+ v.l0 = binary.LittleEndian.Uint64(x[0:8])
+ v.l0 &= maskLow51Bits
+ // Bits 51:102 (bytes 6:14, bits 48:112, shift 3, mask 51).
+ v.l1 = binary.LittleEndian.Uint64(x[6:14]) >> 3
+ v.l1 &= maskLow51Bits
+ // Bits 102:153 (bytes 12:20, bits 96:160, shift 6, mask 51).
+ v.l2 = binary.LittleEndian.Uint64(x[12:20]) >> 6
+ v.l2 &= maskLow51Bits
+ // Bits 153:204 (bytes 19:27, bits 152:216, shift 1, mask 51).
+ v.l3 = binary.LittleEndian.Uint64(x[19:27]) >> 1
+ v.l3 &= maskLow51Bits
+ // Bits 204:251 (bytes 24:32, bits 192:256, shift 12, mask 51).
+ // Note: not bytes 25:33, shift 4, to avoid overread.
+ v.l4 = binary.LittleEndian.Uint64(x[24:32]) >> 12
+ v.l4 &= maskLow51Bits
+
+ return v
+}
+
+// Bytes returns the canonical 32-byte little-endian encoding of v.
+func (v *Element) Bytes() []byte {
+ // This function is outlined to make the allocations inline in the caller
+ // rather than happen on the heap.
+ var out [32]byte
+ return v.bytes(&out)
+}
+
+func (v *Element) bytes(out *[32]byte) []byte {
+ t := *v
+ t.reduce()
+
+ var buf [8]byte
+ for i, l := range [5]uint64{t.l0, t.l1, t.l2, t.l3, t.l4} {
+ bitsOffset := i * 51
+ binary.LittleEndian.PutUint64(buf[:], l<= len(out) {
+ break
+ }
+ out[off] |= bb
+ }
+ }
+
+ return out[:]
+}
+
+// Equal returns 1 if v and u are equal, and 0 otherwise.
+func (v *Element) Equal(u *Element) int {
+ sa, sv := u.Bytes(), v.Bytes()
+ return subtle.ConstantTimeCompare(sa, sv)
+}
+
+// mask64Bits returns 0xffffffff if cond is 1, and 0 otherwise.
+func mask64Bits(cond int) uint64 { return ^(uint64(cond) - 1) }
+
+// Select sets v to a if cond == 1, and to b if cond == 0.
+func (v *Element) Select(a, b *Element, cond int) *Element {
+ m := mask64Bits(cond)
+ v.l0 = (m & a.l0) | (^m & b.l0)
+ v.l1 = (m & a.l1) | (^m & b.l1)
+ v.l2 = (m & a.l2) | (^m & b.l2)
+ v.l3 = (m & a.l3) | (^m & b.l3)
+ v.l4 = (m & a.l4) | (^m & b.l4)
+ return v
+}
+
+// Swap swaps v and u if cond == 1 or leaves them unchanged if cond == 0, and returns v.
+func (v *Element) Swap(u *Element, cond int) {
+ m := mask64Bits(cond)
+ t := m & (v.l0 ^ u.l0)
+ v.l0 ^= t
+ u.l0 ^= t
+ t = m & (v.l1 ^ u.l1)
+ v.l1 ^= t
+ u.l1 ^= t
+ t = m & (v.l2 ^ u.l2)
+ v.l2 ^= t
+ u.l2 ^= t
+ t = m & (v.l3 ^ u.l3)
+ v.l3 ^= t
+ u.l3 ^= t
+ t = m & (v.l4 ^ u.l4)
+ v.l4 ^= t
+ u.l4 ^= t
+}
+
+// IsNegative returns 1 if v is negative, and 0 otherwise.
+func (v *Element) IsNegative() int {
+ return int(v.Bytes()[0] & 1)
+}
+
+// Absolute sets v to |u|, and returns v.
+func (v *Element) Absolute(u *Element) *Element {
+ return v.Select(new(Element).Negate(u), u, u.IsNegative())
+}
+
+// Multiply sets v = x * y, and returns v.
+func (v *Element) Multiply(x, y *Element) *Element {
+ feMul(v, x, y)
+ return v
+}
+
+// Square sets v = x * x, and returns v.
+func (v *Element) Square(x *Element) *Element {
+ feSquare(v, x)
+ return v
+}
+
+// Mult32 sets v = x * y, and returns v.
+func (v *Element) Mult32(x *Element, y uint32) *Element {
+ x0lo, x0hi := mul51(x.l0, y)
+ x1lo, x1hi := mul51(x.l1, y)
+ x2lo, x2hi := mul51(x.l2, y)
+ x3lo, x3hi := mul51(x.l3, y)
+ x4lo, x4hi := mul51(x.l4, y)
+ v.l0 = x0lo + 19*x4hi // carried over per the reduction identity
+ v.l1 = x1lo + x0hi
+ v.l2 = x2lo + x1hi
+ v.l3 = x3lo + x2hi
+ v.l4 = x4lo + x3hi
+ // The hi portions are going to be only 32 bits, plus any previous excess,
+ // so we can skip the carry propagation.
+ return v
+}
+
+// mul51 returns lo + hi * 2⁵¹ = a * b.
+func mul51(a uint64, b uint32) (lo uint64, hi uint64) {
+ mh, ml := bits.Mul64(a, uint64(b))
+ lo = ml & maskLow51Bits
+ hi = (mh << 13) | (ml >> 51)
+ return
+}
+
+// Pow22523 set v = x^((p-5)/8), and returns v. (p-5)/8 is 2^252-3.
+func (v *Element) Pow22523(x *Element) *Element {
+ var t0, t1, t2 Element
+
+ t0.Square(x) // x^2
+ t1.Square(&t0) // x^4
+ t1.Square(&t1) // x^8
+ t1.Multiply(x, &t1) // x^9
+ t0.Multiply(&t0, &t1) // x^11
+ t0.Square(&t0) // x^22
+ t0.Multiply(&t1, &t0) // x^31
+ t1.Square(&t0) // x^62
+ for i := 1; i < 5; i++ { // x^992
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // x^1023 -> 1023 = 2^10 - 1
+ t1.Square(&t0) // 2^11 - 2
+ for i := 1; i < 10; i++ { // 2^20 - 2^10
+ t1.Square(&t1)
+ }
+ t1.Multiply(&t1, &t0) // 2^20 - 1
+ t2.Square(&t1) // 2^21 - 2
+ for i := 1; i < 20; i++ { // 2^40 - 2^20
+ t2.Square(&t2)
+ }
+ t1.Multiply(&t2, &t1) // 2^40 - 1
+ t1.Square(&t1) // 2^41 - 2
+ for i := 1; i < 10; i++ { // 2^50 - 2^10
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // 2^50 - 1
+ t1.Square(&t0) // 2^51 - 2
+ for i := 1; i < 50; i++ { // 2^100 - 2^50
+ t1.Square(&t1)
+ }
+ t1.Multiply(&t1, &t0) // 2^100 - 1
+ t2.Square(&t1) // 2^101 - 2
+ for i := 1; i < 100; i++ { // 2^200 - 2^100
+ t2.Square(&t2)
+ }
+ t1.Multiply(&t2, &t1) // 2^200 - 1
+ t1.Square(&t1) // 2^201 - 2
+ for i := 1; i < 50; i++ { // 2^250 - 2^50
+ t1.Square(&t1)
+ }
+ t0.Multiply(&t1, &t0) // 2^250 - 1
+ t0.Square(&t0) // 2^251 - 2
+ t0.Square(&t0) // 2^252 - 4
+ return v.Multiply(&t0, x) // 2^252 - 3 -> x^(2^252-3)
+}
+
+// sqrtM1 is 2^((p-1)/4), which squared is equal to -1 by Euler's Criterion.
+var sqrtM1 = &Element{1718705420411056, 234908883556509,
+ 2233514472574048, 2117202627021982, 765476049583133}
+
+// SqrtRatio sets r to the non-negative square root of the ratio of u and v.
+//
+// If u/v is square, SqrtRatio returns r and 1. If u/v is not square, SqrtRatio
+// sets r according to Section 4.3 of draft-irtf-cfrg-ristretto255-decaf448-00,
+// and returns r and 0.
+func (r *Element) SqrtRatio(u, v *Element) (rr *Element, wasSquare int) {
+ var a, b Element
+
+ // r = (u * v3) * (u * v7)^((p-5)/8)
+ v2 := a.Square(v)
+ uv3 := b.Multiply(u, b.Multiply(v2, v))
+ uv7 := a.Multiply(uv3, a.Square(v2))
+ r.Multiply(uv3, r.Pow22523(uv7))
+
+ check := a.Multiply(v, a.Square(r)) // check = v * r^2
+
+ uNeg := b.Negate(u)
+ correctSignSqrt := check.Equal(u)
+ flippedSignSqrt := check.Equal(uNeg)
+ flippedSignSqrtI := check.Equal(uNeg.Multiply(uNeg, sqrtM1))
+
+ rPrime := b.Multiply(r, sqrtM1) // r_prime = SQRT_M1 * r
+ // r = CT_SELECT(r_prime IF flipped_sign_sqrt | flipped_sign_sqrt_i ELSE r)
+ r.Select(rPrime, r, flippedSignSqrt|flippedSignSqrtI)
+
+ r.Absolute(r) // Choose the nonnegative square root.
+ return r, correctSignSqrt | flippedSignSqrt
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go
new file mode 100644
index 0000000000..44dc8e8caf
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go
@@ -0,0 +1,13 @@
+// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
+
+// +build amd64,gc,!purego
+
+package field
+
+// feMul sets out = a * b. It works like feMulGeneric.
+//go:noescape
+func feMul(out *Element, a *Element, b *Element)
+
+// feSquare sets out = a * a. It works like feSquareGeneric.
+//go:noescape
+func feSquare(out *Element, a *Element)
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s
new file mode 100644
index 0000000000..293f013c94
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s
@@ -0,0 +1,379 @@
+// Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT.
+
+//go:build amd64 && gc && !purego
+// +build amd64,gc,!purego
+
+#include "textflag.h"
+
+// func feMul(out *Element, a *Element, b *Element)
+TEXT ·feMul(SB), NOSPLIT, $0-24
+ MOVQ a+8(FP), CX
+ MOVQ b+16(FP), BX
+
+ // r0 = a0×b0
+ MOVQ (CX), AX
+ MULQ (BX)
+ MOVQ AX, DI
+ MOVQ DX, SI
+
+ // r0 += 19×a1×b4
+ MOVQ 8(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a2×b3
+ MOVQ 16(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a3×b2
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 16(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r0 += 19×a4×b1
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 8(BX)
+ ADDQ AX, DI
+ ADCQ DX, SI
+
+ // r1 = a0×b1
+ MOVQ (CX), AX
+ MULQ 8(BX)
+ MOVQ AX, R9
+ MOVQ DX, R8
+
+ // r1 += a1×b0
+ MOVQ 8(CX), AX
+ MULQ (BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a2×b4
+ MOVQ 16(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a3×b3
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r1 += 19×a4×b2
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 16(BX)
+ ADDQ AX, R9
+ ADCQ DX, R8
+
+ // r2 = a0×b2
+ MOVQ (CX), AX
+ MULQ 16(BX)
+ MOVQ AX, R11
+ MOVQ DX, R10
+
+ // r2 += a1×b1
+ MOVQ 8(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += a2×b0
+ MOVQ 16(CX), AX
+ MULQ (BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += 19×a3×b4
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r2 += 19×a4×b3
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(BX)
+ ADDQ AX, R11
+ ADCQ DX, R10
+
+ // r3 = a0×b3
+ MOVQ (CX), AX
+ MULQ 24(BX)
+ MOVQ AX, R13
+ MOVQ DX, R12
+
+ // r3 += a1×b2
+ MOVQ 8(CX), AX
+ MULQ 16(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += a2×b1
+ MOVQ 16(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += a3×b0
+ MOVQ 24(CX), AX
+ MULQ (BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r3 += 19×a4×b4
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(BX)
+ ADDQ AX, R13
+ ADCQ DX, R12
+
+ // r4 = a0×b4
+ MOVQ (CX), AX
+ MULQ 32(BX)
+ MOVQ AX, R15
+ MOVQ DX, R14
+
+ // r4 += a1×b3
+ MOVQ 8(CX), AX
+ MULQ 24(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a2×b2
+ MOVQ 16(CX), AX
+ MULQ 16(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a3×b1
+ MOVQ 24(CX), AX
+ MULQ 8(BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // r4 += a4×b0
+ MOVQ 32(CX), AX
+ MULQ (BX)
+ ADDQ AX, R15
+ ADCQ DX, R14
+
+ // First reduction chain
+ MOVQ $0x0007ffffffffffff, AX
+ SHLQ $0x0d, DI, SI
+ SHLQ $0x0d, R9, R8
+ SHLQ $0x0d, R11, R10
+ SHLQ $0x0d, R13, R12
+ SHLQ $0x0d, R15, R14
+ ANDQ AX, DI
+ IMUL3Q $0x13, R14, R14
+ ADDQ R14, DI
+ ANDQ AX, R9
+ ADDQ SI, R9
+ ANDQ AX, R11
+ ADDQ R8, R11
+ ANDQ AX, R13
+ ADDQ R10, R13
+ ANDQ AX, R15
+ ADDQ R12, R15
+
+ // Second reduction chain (carryPropagate)
+ MOVQ DI, SI
+ SHRQ $0x33, SI
+ MOVQ R9, R8
+ SHRQ $0x33, R8
+ MOVQ R11, R10
+ SHRQ $0x33, R10
+ MOVQ R13, R12
+ SHRQ $0x33, R12
+ MOVQ R15, R14
+ SHRQ $0x33, R14
+ ANDQ AX, DI
+ IMUL3Q $0x13, R14, R14
+ ADDQ R14, DI
+ ANDQ AX, R9
+ ADDQ SI, R9
+ ANDQ AX, R11
+ ADDQ R8, R11
+ ANDQ AX, R13
+ ADDQ R10, R13
+ ANDQ AX, R15
+ ADDQ R12, R15
+
+ // Store output
+ MOVQ out+0(FP), AX
+ MOVQ DI, (AX)
+ MOVQ R9, 8(AX)
+ MOVQ R11, 16(AX)
+ MOVQ R13, 24(AX)
+ MOVQ R15, 32(AX)
+ RET
+
+// func feSquare(out *Element, a *Element)
+TEXT ·feSquare(SB), NOSPLIT, $0-16
+ MOVQ a+8(FP), CX
+
+ // r0 = l0×l0
+ MOVQ (CX), AX
+ MULQ (CX)
+ MOVQ AX, SI
+ MOVQ DX, BX
+
+ // r0 += 38×l1×l4
+ MOVQ 8(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, SI
+ ADCQ DX, BX
+
+ // r0 += 38×l2×l3
+ MOVQ 16(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, SI
+ ADCQ DX, BX
+
+ // r1 = 2×l0×l1
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 8(CX)
+ MOVQ AX, R8
+ MOVQ DX, DI
+
+ // r1 += 38×l2×l4
+ MOVQ 16(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R8
+ ADCQ DX, DI
+
+ // r1 += 19×l3×l3
+ MOVQ 24(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, R8
+ ADCQ DX, DI
+
+ // r2 = 2×l0×l2
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 16(CX)
+ MOVQ AX, R10
+ MOVQ DX, R9
+
+ // r2 += l1×l1
+ MOVQ 8(CX), AX
+ MULQ 8(CX)
+ ADDQ AX, R10
+ ADCQ DX, R9
+
+ // r2 += 38×l3×l4
+ MOVQ 24(CX), AX
+ IMUL3Q $0x26, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R10
+ ADCQ DX, R9
+
+ // r3 = 2×l0×l3
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 24(CX)
+ MOVQ AX, R12
+ MOVQ DX, R11
+
+ // r3 += 2×l1×l2
+ MOVQ 8(CX), AX
+ IMUL3Q $0x02, AX, AX
+ MULQ 16(CX)
+ ADDQ AX, R12
+ ADCQ DX, R11
+
+ // r3 += 19×l4×l4
+ MOVQ 32(CX), AX
+ IMUL3Q $0x13, AX, AX
+ MULQ 32(CX)
+ ADDQ AX, R12
+ ADCQ DX, R11
+
+ // r4 = 2×l0×l4
+ MOVQ (CX), AX
+ SHLQ $0x01, AX
+ MULQ 32(CX)
+ MOVQ AX, R14
+ MOVQ DX, R13
+
+ // r4 += 2×l1×l3
+ MOVQ 8(CX), AX
+ IMUL3Q $0x02, AX, AX
+ MULQ 24(CX)
+ ADDQ AX, R14
+ ADCQ DX, R13
+
+ // r4 += l2×l2
+ MOVQ 16(CX), AX
+ MULQ 16(CX)
+ ADDQ AX, R14
+ ADCQ DX, R13
+
+ // First reduction chain
+ MOVQ $0x0007ffffffffffff, AX
+ SHLQ $0x0d, SI, BX
+ SHLQ $0x0d, R8, DI
+ SHLQ $0x0d, R10, R9
+ SHLQ $0x0d, R12, R11
+ SHLQ $0x0d, R14, R13
+ ANDQ AX, SI
+ IMUL3Q $0x13, R13, R13
+ ADDQ R13, SI
+ ANDQ AX, R8
+ ADDQ BX, R8
+ ANDQ AX, R10
+ ADDQ DI, R10
+ ANDQ AX, R12
+ ADDQ R9, R12
+ ANDQ AX, R14
+ ADDQ R11, R14
+
+ // Second reduction chain (carryPropagate)
+ MOVQ SI, BX
+ SHRQ $0x33, BX
+ MOVQ R8, DI
+ SHRQ $0x33, DI
+ MOVQ R10, R9
+ SHRQ $0x33, R9
+ MOVQ R12, R11
+ SHRQ $0x33, R11
+ MOVQ R14, R13
+ SHRQ $0x33, R13
+ ANDQ AX, SI
+ IMUL3Q $0x13, R13, R13
+ ADDQ R13, SI
+ ANDQ AX, R8
+ ADDQ BX, R8
+ ANDQ AX, R10
+ ADDQ DI, R10
+ ANDQ AX, R12
+ ADDQ R9, R12
+ ANDQ AX, R14
+ ADDQ R11, R14
+
+ // Store output
+ MOVQ out+0(FP), AX
+ MOVQ SI, (AX)
+ MOVQ R8, 8(AX)
+ MOVQ R10, 16(AX)
+ MOVQ R12, 24(AX)
+ MOVQ R14, 32(AX)
+ RET
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go
new file mode 100644
index 0000000000..ddb6c9b8f7
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go
@@ -0,0 +1,12 @@
+// Copyright (c) 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !amd64 || !gc || purego
+// +build !amd64 !gc purego
+
+package field
+
+func feMul(v, x, y *Element) { feMulGeneric(v, x, y) }
+
+func feSquare(v, x *Element) { feSquareGeneric(v, x) }
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go
new file mode 100644
index 0000000000..af459ef515
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go
@@ -0,0 +1,16 @@
+// Copyright (c) 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build arm64 && gc && !purego
+// +build arm64,gc,!purego
+
+package field
+
+//go:noescape
+func carryPropagate(v *Element)
+
+func (v *Element) carryPropagate() *Element {
+ carryPropagate(v)
+ return v
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s
new file mode 100644
index 0000000000..5c91e45892
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s
@@ -0,0 +1,43 @@
+// Copyright (c) 2020 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build arm64 && gc && !purego
+// +build arm64,gc,!purego
+
+#include "textflag.h"
+
+// carryPropagate works exactly like carryPropagateGeneric and uses the
+// same AND, ADD, and LSR+MADD instructions emitted by the compiler, but
+// avoids loading R0-R4 twice and uses LDP and STP.
+//
+// See https://golang.org/issues/43145 for the main compiler issue.
+//
+// func carryPropagate(v *Element)
+TEXT ·carryPropagate(SB),NOFRAME|NOSPLIT,$0-8
+ MOVD v+0(FP), R20
+
+ LDP 0(R20), (R0, R1)
+ LDP 16(R20), (R2, R3)
+ MOVD 32(R20), R4
+
+ AND $0x7ffffffffffff, R0, R10
+ AND $0x7ffffffffffff, R1, R11
+ AND $0x7ffffffffffff, R2, R12
+ AND $0x7ffffffffffff, R3, R13
+ AND $0x7ffffffffffff, R4, R14
+
+ ADD R0>>51, R11, R11
+ ADD R1>>51, R12, R12
+ ADD R2>>51, R13, R13
+ ADD R3>>51, R14, R14
+ // R4>>51 * 19 + R10 -> R10
+ LSR $51, R4, R21
+ MOVD $19, R22
+ MADD R22, R10, R21, R10
+
+ STP (R10, R11), 0(R20)
+ STP (R12, R13), 16(R20)
+ MOVD R14, 32(R20)
+
+ RET
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go
new file mode 100644
index 0000000000..234a5b2e5d
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go
@@ -0,0 +1,12 @@
+// Copyright (c) 2021 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+//go:build !arm64 || !gc || purego
+// +build !arm64 !gc purego
+
+package field
+
+func (v *Element) carryPropagate() *Element {
+ return v.carryPropagateGeneric()
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go
new file mode 100644
index 0000000000..7b5b78cbd6
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go
@@ -0,0 +1,264 @@
+// Copyright (c) 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package field
+
+import "math/bits"
+
+// uint128 holds a 128-bit number as two 64-bit limbs, for use with the
+// bits.Mul64 and bits.Add64 intrinsics.
+type uint128 struct {
+ lo, hi uint64
+}
+
+// mul64 returns a * b.
+func mul64(a, b uint64) uint128 {
+ hi, lo := bits.Mul64(a, b)
+ return uint128{lo, hi}
+}
+
+// addMul64 returns v + a * b.
+func addMul64(v uint128, a, b uint64) uint128 {
+ hi, lo := bits.Mul64(a, b)
+ lo, c := bits.Add64(lo, v.lo, 0)
+ hi, _ = bits.Add64(hi, v.hi, c)
+ return uint128{lo, hi}
+}
+
+// shiftRightBy51 returns a >> 51. a is assumed to be at most 115 bits.
+func shiftRightBy51(a uint128) uint64 {
+ return (a.hi << (64 - 51)) | (a.lo >> 51)
+}
+
+func feMulGeneric(v, a, b *Element) {
+ a0 := a.l0
+ a1 := a.l1
+ a2 := a.l2
+ a3 := a.l3
+ a4 := a.l4
+
+ b0 := b.l0
+ b1 := b.l1
+ b2 := b.l2
+ b3 := b.l3
+ b4 := b.l4
+
+ // Limb multiplication works like pen-and-paper columnar multiplication, but
+ // with 51-bit limbs instead of digits.
+ //
+ // a4 a3 a2 a1 a0 x
+ // b4 b3 b2 b1 b0 =
+ // ------------------------
+ // a4b0 a3b0 a2b0 a1b0 a0b0 +
+ // a4b1 a3b1 a2b1 a1b1 a0b1 +
+ // a4b2 a3b2 a2b2 a1b2 a0b2 +
+ // a4b3 a3b3 a2b3 a1b3 a0b3 +
+ // a4b4 a3b4 a2b4 a1b4 a0b4 =
+ // ----------------------------------------------
+ // r8 r7 r6 r5 r4 r3 r2 r1 r0
+ //
+ // We can then use the reduction identity (a * 2²⁵⁵ + b = a * 19 + b) to
+ // reduce the limbs that would overflow 255 bits. r5 * 2²⁵⁵ becomes 19 * r5,
+ // r6 * 2³⁰⁶ becomes 19 * r6 * 2⁵¹, etc.
+ //
+ // Reduction can be carried out simultaneously to multiplication. For
+ // example, we do not compute r5: whenever the result of a multiplication
+ // belongs to r5, like a1b4, we multiply it by 19 and add the result to r0.
+ //
+ // a4b0 a3b0 a2b0 a1b0 a0b0 +
+ // a3b1 a2b1 a1b1 a0b1 19×a4b1 +
+ // a2b2 a1b2 a0b2 19×a4b2 19×a3b2 +
+ // a1b3 a0b3 19×a4b3 19×a3b3 19×a2b3 +
+ // a0b4 19×a4b4 19×a3b4 19×a2b4 19×a1b4 =
+ // --------------------------------------
+ // r4 r3 r2 r1 r0
+ //
+ // Finally we add up the columns into wide, overlapping limbs.
+
+ a1_19 := a1 * 19
+ a2_19 := a2 * 19
+ a3_19 := a3 * 19
+ a4_19 := a4 * 19
+
+ // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1)
+ r0 := mul64(a0, b0)
+ r0 = addMul64(r0, a1_19, b4)
+ r0 = addMul64(r0, a2_19, b3)
+ r0 = addMul64(r0, a3_19, b2)
+ r0 = addMul64(r0, a4_19, b1)
+
+ // r1 = a0×b1 + a1×b0 + 19×(a2×b4 + a3×b3 + a4×b2)
+ r1 := mul64(a0, b1)
+ r1 = addMul64(r1, a1, b0)
+ r1 = addMul64(r1, a2_19, b4)
+ r1 = addMul64(r1, a3_19, b3)
+ r1 = addMul64(r1, a4_19, b2)
+
+ // r2 = a0×b2 + a1×b1 + a2×b0 + 19×(a3×b4 + a4×b3)
+ r2 := mul64(a0, b2)
+ r2 = addMul64(r2, a1, b1)
+ r2 = addMul64(r2, a2, b0)
+ r2 = addMul64(r2, a3_19, b4)
+ r2 = addMul64(r2, a4_19, b3)
+
+ // r3 = a0×b3 + a1×b2 + a2×b1 + a3×b0 + 19×a4×b4
+ r3 := mul64(a0, b3)
+ r3 = addMul64(r3, a1, b2)
+ r3 = addMul64(r3, a2, b1)
+ r3 = addMul64(r3, a3, b0)
+ r3 = addMul64(r3, a4_19, b4)
+
+ // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0
+ r4 := mul64(a0, b4)
+ r4 = addMul64(r4, a1, b3)
+ r4 = addMul64(r4, a2, b2)
+ r4 = addMul64(r4, a3, b1)
+ r4 = addMul64(r4, a4, b0)
+
+ // After the multiplication, we need to reduce (carry) the five coefficients
+ // to obtain a result with limbs that are at most slightly larger than 2⁵¹,
+ // to respect the Element invariant.
+ //
+ // Overall, the reduction works the same as carryPropagate, except with
+ // wider inputs: we take the carry for each coefficient by shifting it right
+ // by 51, and add it to the limb above it. The top carry is multiplied by 19
+ // according to the reduction identity and added to the lowest limb.
+ //
+ // The largest coefficient (r0) will be at most 111 bits, which guarantees
+ // that all carries are at most 111 - 51 = 60 bits, which fits in a uint64.
+ //
+ // r0 = a0×b0 + 19×(a1×b4 + a2×b3 + a3×b2 + a4×b1)
+ // r0 < 2⁵²×2⁵² + 19×(2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵² + 2⁵²×2⁵²)
+ // r0 < (1 + 19 × 4) × 2⁵² × 2⁵²
+ // r0 < 2⁷ × 2⁵² × 2⁵²
+ // r0 < 2¹¹¹
+ //
+ // Moreover, the top coefficient (r4) is at most 107 bits, so c4 is at most
+ // 56 bits, and c4 * 19 is at most 61 bits, which again fits in a uint64 and
+ // allows us to easily apply the reduction identity.
+ //
+ // r4 = a0×b4 + a1×b3 + a2×b2 + a3×b1 + a4×b0
+ // r4 < 5 × 2⁵² × 2⁵²
+ // r4 < 2¹⁰⁷
+ //
+
+ c0 := shiftRightBy51(r0)
+ c1 := shiftRightBy51(r1)
+ c2 := shiftRightBy51(r2)
+ c3 := shiftRightBy51(r3)
+ c4 := shiftRightBy51(r4)
+
+ rr0 := r0.lo&maskLow51Bits + c4*19
+ rr1 := r1.lo&maskLow51Bits + c0
+ rr2 := r2.lo&maskLow51Bits + c1
+ rr3 := r3.lo&maskLow51Bits + c2
+ rr4 := r4.lo&maskLow51Bits + c3
+
+ // Now all coefficients fit into 64-bit registers but are still too large to
+ // be passed around as a Element. We therefore do one last carry chain,
+ // where the carries will be small enough to fit in the wiggle room above 2⁵¹.
+ *v = Element{rr0, rr1, rr2, rr3, rr4}
+ v.carryPropagate()
+}
+
+func feSquareGeneric(v, a *Element) {
+ l0 := a.l0
+ l1 := a.l1
+ l2 := a.l2
+ l3 := a.l3
+ l4 := a.l4
+
+ // Squaring works precisely like multiplication above, but thanks to its
+ // symmetry we get to group a few terms together.
+ //
+ // l4 l3 l2 l1 l0 x
+ // l4 l3 l2 l1 l0 =
+ // ------------------------
+ // l4l0 l3l0 l2l0 l1l0 l0l0 +
+ // l4l1 l3l1 l2l1 l1l1 l0l1 +
+ // l4l2 l3l2 l2l2 l1l2 l0l2 +
+ // l4l3 l3l3 l2l3 l1l3 l0l3 +
+ // l4l4 l3l4 l2l4 l1l4 l0l4 =
+ // ----------------------------------------------
+ // r8 r7 r6 r5 r4 r3 r2 r1 r0
+ //
+ // l4l0 l3l0 l2l0 l1l0 l0l0 +
+ // l3l1 l2l1 l1l1 l0l1 19×l4l1 +
+ // l2l2 l1l2 l0l2 19×l4l2 19×l3l2 +
+ // l1l3 l0l3 19×l4l3 19×l3l3 19×l2l3 +
+ // l0l4 19×l4l4 19×l3l4 19×l2l4 19×l1l4 =
+ // --------------------------------------
+ // r4 r3 r2 r1 r0
+ //
+ // With precomputed 2×, 19×, and 2×19× terms, we can compute each limb with
+ // only three Mul64 and four Add64, instead of five and eight.
+
+ l0_2 := l0 * 2
+ l1_2 := l1 * 2
+
+ l1_38 := l1 * 38
+ l2_38 := l2 * 38
+ l3_38 := l3 * 38
+
+ l3_19 := l3 * 19
+ l4_19 := l4 * 19
+
+ // r0 = l0×l0 + 19×(l1×l4 + l2×l3 + l3×l2 + l4×l1) = l0×l0 + 19×2×(l1×l4 + l2×l3)
+ r0 := mul64(l0, l0)
+ r0 = addMul64(r0, l1_38, l4)
+ r0 = addMul64(r0, l2_38, l3)
+
+ // r1 = l0×l1 + l1×l0 + 19×(l2×l4 + l3×l3 + l4×l2) = 2×l0×l1 + 19×2×l2×l4 + 19×l3×l3
+ r1 := mul64(l0_2, l1)
+ r1 = addMul64(r1, l2_38, l4)
+ r1 = addMul64(r1, l3_19, l3)
+
+ // r2 = l0×l2 + l1×l1 + l2×l0 + 19×(l3×l4 + l4×l3) = 2×l0×l2 + l1×l1 + 19×2×l3×l4
+ r2 := mul64(l0_2, l2)
+ r2 = addMul64(r2, l1, l1)
+ r2 = addMul64(r2, l3_38, l4)
+
+ // r3 = l0×l3 + l1×l2 + l2×l1 + l3×l0 + 19×l4×l4 = 2×l0×l3 + 2×l1×l2 + 19×l4×l4
+ r3 := mul64(l0_2, l3)
+ r3 = addMul64(r3, l1_2, l2)
+ r3 = addMul64(r3, l4_19, l4)
+
+ // r4 = l0×l4 + l1×l3 + l2×l2 + l3×l1 + l4×l0 = 2×l0×l4 + 2×l1×l3 + l2×l2
+ r4 := mul64(l0_2, l4)
+ r4 = addMul64(r4, l1_2, l3)
+ r4 = addMul64(r4, l2, l2)
+
+ c0 := shiftRightBy51(r0)
+ c1 := shiftRightBy51(r1)
+ c2 := shiftRightBy51(r2)
+ c3 := shiftRightBy51(r3)
+ c4 := shiftRightBy51(r4)
+
+ rr0 := r0.lo&maskLow51Bits + c4*19
+ rr1 := r1.lo&maskLow51Bits + c0
+ rr2 := r2.lo&maskLow51Bits + c1
+ rr3 := r3.lo&maskLow51Bits + c2
+ rr4 := r4.lo&maskLow51Bits + c3
+
+ *v = Element{rr0, rr1, rr2, rr3, rr4}
+ v.carryPropagate()
+}
+
+// carryPropagate brings the limbs below 52 bits by applying the reduction
+// identity (a * 2²⁵⁵ + b = a * 19 + b) to the l4 carry. TODO inline
+func (v *Element) carryPropagateGeneric() *Element {
+ c0 := v.l0 >> 51
+ c1 := v.l1 >> 51
+ c2 := v.l2 >> 51
+ c3 := v.l3 >> 51
+ c4 := v.l4 >> 51
+
+ v.l0 = v.l0&maskLow51Bits + c4*19
+ v.l1 = v.l1&maskLow51Bits + c0
+ v.l2 = v.l2&maskLow51Bits + c1
+ v.l3 = v.l3&maskLow51Bits + c2
+ v.l4 = v.l4&maskLow51Bits + c3
+
+ return v
+}
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint
new file mode 100644
index 0000000000..e3685f95ca
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint
@@ -0,0 +1 @@
+b0c49ae9f59d233526f8934262c5bbbe14d4358d
diff --git a/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh
new file mode 100644
index 0000000000..1ba22a8b4c
--- /dev/null
+++ b/vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh
@@ -0,0 +1,19 @@
+#! /bin/bash
+set -euo pipefail
+
+cd "$(git rev-parse --show-toplevel)"
+
+STD_PATH=src/crypto/ed25519/internal/edwards25519/field
+LOCAL_PATH=curve25519/internal/field
+LAST_SYNC_REF=$(cat $LOCAL_PATH/sync.checkpoint)
+
+git fetch https://go.googlesource.com/go master
+
+if git diff --quiet $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH; then
+ echo "No changes."
+else
+ NEW_REF=$(git rev-parse FETCH_HEAD | tee $LOCAL_PATH/sync.checkpoint)
+ echo "Applying changes from $LAST_SYNC_REF to $NEW_REF..."
+ git diff $LAST_SYNC_REF:$STD_PATH FETCH_HEAD:$STD_PATH | \
+ git apply -3 --directory=$LOCAL_PATH
+fi
diff --git a/vendor/golang.org/x/crypto/poly1305/bits_compat.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/bits_compat.go
rename to vendor/golang.org/x/crypto/internal/poly1305/bits_compat.go
diff --git a/vendor/golang.org/x/crypto/poly1305/bits_go1.13.go b/vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/bits_go1.13.go
rename to vendor/golang.org/x/crypto/internal/poly1305/bits_go1.13.go
diff --git a/vendor/golang.org/x/crypto/poly1305/mac_noasm.go b/vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/mac_noasm.go
rename to vendor/golang.org/x/crypto/internal/poly1305/mac_noasm.go
diff --git a/vendor/golang.org/x/crypto/poly1305/poly1305.go b/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
similarity index 98%
rename from vendor/golang.org/x/crypto/poly1305/poly1305.go
rename to vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
index 9d7a6af09f..4aaea810a2 100644
--- a/vendor/golang.org/x/crypto/poly1305/poly1305.go
+++ b/vendor/golang.org/x/crypto/internal/poly1305/poly1305.go
@@ -15,7 +15,7 @@
// used with a fixed key in order to generate one-time keys from an nonce.
// However, in this package AES isn't used and the one-time key is specified
// directly.
-package poly1305 // import "golang.org/x/crypto/poly1305"
+package poly1305
import "crypto/subtle"
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/sum_amd64.go
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.go
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
similarity index 99%
rename from vendor/golang.org/x/crypto/poly1305/sum_amd64.s
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
index 2cb0373140..1d74f0f881 100644
--- a/vendor/golang.org/x/crypto/poly1305/sum_amd64.s
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_amd64.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_generic.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/sum_generic.go
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_generic.go
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/sum_ppc64le.go
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.go
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s
similarity index 95%
rename from vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s
index 5cd7494b21..58422aad23 100644
--- a/vendor/golang.org/x/crypto/poly1305/sum_ppc64le.s
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_ppc64le.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"
@@ -82,7 +83,7 @@ multiply:
BGE loop
bytes_between_0_and_15:
- CMP $0, R5
+ CMP R5, $0
BEQ done
MOVD $0, R16 // h0
MOVD $0, R17 // h1
@@ -122,7 +123,7 @@ just1:
// Exactly 8
MOVD (R4), R16
- CMP $0, R17
+ CMP R17, $0
// Check if we've already set R17; if not
// set 1 to indicate end of msg.
@@ -151,7 +152,7 @@ less4:
ADD $2, R4
less2:
- CMP $0, R5
+ CMP R5, $0
BEQ insert1
MOVBZ (R4), R21
SLD R22, R21, R21
@@ -166,12 +167,12 @@ insert1:
carry:
// Add new values to h0, h1, h2
- ADDC R16, R8
- ADDE R17, R9
- ADDE $0, R10
- MOVD $16, R5
- ADD R5, R4
- BR multiply
+ ADDC R16, R8
+ ADDE R17, R9
+ ADDZE R10, R10
+ MOVD $16, R5
+ ADD R5, R4
+ BR multiply
done:
// Save h0, h1, h2 in state
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.go b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
similarity index 100%
rename from vendor/golang.org/x/crypto/poly1305/sum_s390x.go
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.go
diff --git a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
similarity index 99%
rename from vendor/golang.org/x/crypto/poly1305/sum_s390x.s
rename to vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
index bdd882c606..aa9e0494c9 100644
--- a/vendor/golang.org/x/crypto/poly1305/sum_s390x.s
+++ b/vendor/golang.org/x/crypto/internal/poly1305/sum_s390x.s
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build gc && !purego
// +build gc,!purego
#include "textflag.h"
@@ -17,7 +18,7 @@
// value. These limbs are, for the most part, zero extended and
// placed into 64-bit vector register elements. Each vector
// register is 128-bits wide and so holds 2 of these elements.
-// Using 26-bit limbs allows us plenty of headroom to accomodate
+// Using 26-bit limbs allows us plenty of headroom to accommodate
// accumulations before and after multiplication without
// overflowing either 32-bits (before multiplication) or 64-bits
// (after multiplication).
diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go
index 8bd6b3daff..bddbde5dbd 100644
--- a/vendor/golang.org/x/crypto/ssh/cipher.go
+++ b/vendor/golang.org/x/crypto/ssh/cipher.go
@@ -18,7 +18,7 @@ import (
"io/ioutil"
"golang.org/x/crypto/chacha20"
- "golang.org/x/crypto/poly1305"
+ "golang.org/x/crypto/internal/poly1305"
)
const (
diff --git a/vendor/golang.org/x/crypto/ssh/client.go b/vendor/golang.org/x/crypto/ssh/client.go
index 7b00bff1ca..99f68bd32e 100644
--- a/vendor/golang.org/x/crypto/ssh/client.go
+++ b/vendor/golang.org/x/crypto/ssh/client.go
@@ -77,7 +77,7 @@ func NewClientConn(c net.Conn, addr string, config *ClientConfig) (Conn, <-chan
}
conn := &connection{
- sshConn: sshConn{conn: c},
+ sshConn: sshConn{conn: c, user: fullConf.User},
}
if err := conn.clientHandshake(addr, &fullConf); err != nil {
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 1c590a5310..bd0d58bb37 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -8,11 +8,10 @@ github.com/Azure/azure-sdk-for-go/services/privatedns/mgmt/2018-09-01/privatedns
github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources
github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2018-05-01/resources
github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-02-01/storage
-github.com/Azure/azure-sdk-for-go/storage
github.com/Azure/azure-sdk-for-go/version
# github.com/Azure/go-autorest v14.2.0+incompatible
github.com/Azure/go-autorest
-# github.com/Azure/go-autorest/autorest v0.11.21
+# github.com/Azure/go-autorest/autorest v0.11.22
## explicit
github.com/Azure/go-autorest/autorest
github.com/Azure/go-autorest/autorest/azure
@@ -80,8 +79,6 @@ github.com/evanphx/json-patch
github.com/fsnotify/fsnotify
# github.com/go-logr/logr v0.4.0
github.com/go-logr/logr
-# github.com/gofrs/uuid v4.0.0+incompatible
-github.com/gofrs/uuid
# github.com/gogo/protobuf v1.3.2
github.com/gogo/protobuf/proto
github.com/gogo/protobuf/sortkeys
@@ -226,24 +223,23 @@ github.com/prometheus/common/model
github.com/prometheus/procfs
github.com/prometheus/procfs/internal/fs
github.com/prometheus/procfs/internal/util
-# github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021
-github.com/rubiojr/go-vhd/vhd
# github.com/spf13/pflag v1.0.5
github.com/spf13/pflag
# github.com/stretchr/testify v1.7.0
## explicit
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
-# golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
+# golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/crypto/blowfish
golang.org/x/crypto/chacha20
golang.org/x/crypto/curve25519
+golang.org/x/crypto/curve25519/internal/field
golang.org/x/crypto/ed25519
golang.org/x/crypto/ed25519/internal/edwards25519
+golang.org/x/crypto/internal/poly1305
golang.org/x/crypto/internal/subtle
golang.org/x/crypto/pkcs12
golang.org/x/crypto/pkcs12/internal/rc2
-golang.org/x/crypto/poly1305
golang.org/x/crypto/ssh
golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
# golang.org/x/net v0.0.0-20210428140749-89ef3d95e781
@@ -382,7 +378,7 @@ gopkg.in/tomb.v1
gopkg.in/yaml.v2
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
gopkg.in/yaml.v3
-# k8s.io/api v0.22.3 => k8s.io/api v0.21.0
+# k8s.io/api v0.22.4 => k8s.io/api v0.21.0
## explicit
k8s.io/api/admission/v1
k8s.io/api/admission/v1beta1
@@ -429,7 +425,7 @@ k8s.io/api/scheduling/v1beta1
k8s.io/api/storage/v1
k8s.io/api/storage/v1alpha1
k8s.io/api/storage/v1beta1
-# k8s.io/apimachinery v0.22.3 => k8s.io/apimachinery v0.21.0
+# k8s.io/apimachinery v0.22.4 => k8s.io/apimachinery v0.21.0
## explicit
k8s.io/apimachinery/pkg/api/equality
k8s.io/apimachinery/pkg/api/errors
@@ -486,7 +482,7 @@ k8s.io/apimachinery/pkg/watch
k8s.io/apimachinery/third_party/forked/golang/json
k8s.io/apimachinery/third_party/forked/golang/netutil
k8s.io/apimachinery/third_party/forked/golang/reflect
-# k8s.io/apiserver v0.22.3 => k8s.io/apiserver v0.21.0
+# k8s.io/apiserver v0.22.4 => k8s.io/apiserver v0.21.0
k8s.io/apiserver/pkg/admission
k8s.io/apiserver/pkg/admission/configuration
k8s.io/apiserver/pkg/admission/initializer
@@ -525,7 +521,7 @@ k8s.io/apiserver/pkg/storage/names
k8s.io/apiserver/pkg/util/feature
k8s.io/apiserver/pkg/util/webhook
k8s.io/apiserver/pkg/warning
-# k8s.io/client-go v0.22.3 => k8s.io/client-go v0.21.0
+# k8s.io/client-go v0.22.4 => k8s.io/client-go v0.21.0
## explicit
k8s.io/client-go/applyconfigurations/admissionregistration/v1
k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1
@@ -753,7 +749,7 @@ k8s.io/client-go/util/homedir
k8s.io/client-go/util/keyutil
k8s.io/client-go/util/retry
k8s.io/client-go/util/workqueue
-# k8s.io/cloud-provider v0.22.2 => k8s.io/cloud-provider v0.21.0
+# k8s.io/cloud-provider v0.22.3 => k8s.io/cloud-provider v0.21.0
## explicit
k8s.io/cloud-provider
k8s.io/cloud-provider/fake
@@ -761,7 +757,7 @@ k8s.io/cloud-provider/service/helpers
k8s.io/cloud-provider/volume
k8s.io/cloud-provider/volume/errors
k8s.io/cloud-provider/volume/helpers
-# k8s.io/component-base v0.22.3 => k8s.io/component-base v0.21.0
+# k8s.io/component-base v0.22.4 => k8s.io/component-base v0.21.0
## explicit
k8s.io/component-base/cli/flag
k8s.io/component-base/config
@@ -782,7 +778,7 @@ k8s.io/kube-openapi/pkg/util/proto
# k8s.io/kubectl v0.0.0 => k8s.io/kubectl v0.21.0
k8s.io/kubectl/pkg/scale
k8s.io/kubectl/pkg/util/podutils
-# k8s.io/kubelet v0.22.2 => k8s.io/kubelet v0.21.0
+# k8s.io/kubelet v0.22.4 => k8s.io/kubelet v0.21.0
k8s.io/kubelet/pkg/apis/stats/v1alpha1
# k8s.io/kubernetes v1.21.1
## explicit
@@ -871,7 +867,7 @@ k8s.io/utils/trace
# sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.15
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/pkg/client
sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client
-# sigs.k8s.io/cloud-provider-azure v0.7.4 => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211112065827-1353b97f4161
+# sigs.k8s.io/cloud-provider-azure v0.7.4 => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211122060509-bb8d775d86d1
## explicit
sigs.k8s.io/cloud-provider-azure/pkg/auth
sigs.k8s.io/cloud-provider-azure/pkg/azureclients
@@ -955,4 +951,4 @@ sigs.k8s.io/yaml
# k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.21.0
# k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.21.0
# k8s.io/sample-controller => k8s.io/sample-controller v0.21.0
-# sigs.k8s.io/cloud-provider-azure => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211112065827-1353b97f4161
+# sigs.k8s.io/cloud-provider-azure => sigs.k8s.io/cloud-provider-azure v0.7.4-0.20211122060509-bb8d775d86d1
diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go
index 4a7be28184..a59bfd86c5 100644
--- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go
+++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure.go
@@ -325,7 +325,6 @@ type Cloud struct {
nsgCache *azcache.TimedCache
rtCache *azcache.TimedCache
- *BlobDiskController
*ManagedDiskController
*controllerCommon
}
@@ -926,7 +925,6 @@ func initDiskControllers(az *Cloud) error {
}
}
- az.BlobDiskController = &BlobDiskController{common: common}
az.ManagedDiskController = &ManagedDiskController{common: common}
az.controllerCommon = common
diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_blobDiskController.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_blobDiskController.go
deleted file mode 100644
index 992f4c1396..0000000000
--- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_blobDiskController.go
+++ /dev/null
@@ -1,643 +0,0 @@
-/*
-Copyright 2020 The Kubernetes Authors.
-
-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.
-*/
-
-package provider
-
-import (
- "bytes"
- "context"
- "encoding/binary"
- "errors"
- "fmt"
- "net/url"
- "regexp"
- "strings"
- "sync"
- "sync/atomic"
- "time"
-
- "sigs.k8s.io/cloud-provider-azure/pkg/consts"
-
- "github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2021-02-01/storage"
- azstorage "github.com/Azure/azure-sdk-for-go/storage"
- "github.com/Azure/go-autorest/autorest/to"
- "github.com/rubiojr/go-vhd/vhd"
-
- kwait "k8s.io/apimachinery/pkg/util/wait"
- volerr "k8s.io/cloud-provider/volume/errors"
- "k8s.io/klog/v2"
-)
-
-// Attention: blob disk feature is deprecated
-
-type storageAccountState struct {
- name string
- saType storage.SkuName
- key string
- diskCount int32
- isValidating int32
- defaultContainerCreated bool
-}
-
-//BlobDiskController : blob disk controller struct
-type BlobDiskController struct {
- common *controllerCommon
- accounts map[string]*storageAccountState
-}
-
-var (
- accountsLock = &sync.Mutex{}
-)
-
-func (c *BlobDiskController) initStorageAccounts() {
- accountsLock.Lock()
- defer accountsLock.Unlock()
-
- if c.accounts == nil {
- // get accounts
- accounts, err := c.getAllStorageAccounts()
- if err != nil {
- klog.Errorf("azureDisk - getAllStorageAccounts error: %v", err)
- c.accounts = make(map[string]*storageAccountState)
- }
- c.accounts = accounts
- }
-}
-
-// CreateVolume creates a VHD blob in a storage account that has storageType and location using the given storage account.
-// If no storage account is given, search all the storage accounts associated with the resource group and pick one that
-// fits storage type and location.
-func (c *BlobDiskController) CreateVolume(ctx context.Context, blobName, accountName, accountType, location string, requestGB int) (string, string, int, error) {
- accountOptions := &AccountOptions{
- Name: accountName,
- Type: accountType,
- Kind: string(consts.DefaultStorageAccountKind),
- ResourceGroup: c.common.resourceGroup,
- Location: location,
- EnableHTTPSTrafficOnly: true,
- }
- account, key, err := c.common.cloud.EnsureStorageAccount(ctx, accountOptions, consts.DedicatedDiskAccountNamePrefix)
- if err != nil {
- return "", "", 0, fmt.Errorf("could not get storage key for storage account %s: %w", accountName, err)
- }
-
- client, err := azstorage.NewBasicClientOnSovereignCloud(account, key, c.common.cloud.Environment)
- if err != nil {
- return "", "", 0, err
- }
- blobClient := client.GetBlobService()
-
- // create a page blob in this account's vhd container
- diskName, diskURI, err := c.createVHDBlobDisk(blobClient, account, blobName, consts.VhdContainerName, int64(requestGB))
- if err != nil {
- return "", "", 0, err
- }
-
- klog.V(4).Infof("azureDisk - created vhd blob uri: %s", diskURI)
- return diskName, diskURI, requestGB, err
-}
-
-// DeleteVolume deletes a VHD blob
-func (c *BlobDiskController) DeleteVolume(ctx context.Context, diskURI string) error {
- klog.V(4).Infof("azureDisk - begin to delete volume %s", diskURI)
- accountName, blob, err := c.common.cloud.getBlobNameAndAccountFromURI(diskURI)
- if err != nil {
- return fmt.Errorf("failed to parse vhd URI %w", err)
- }
- key, err := c.common.cloud.GetStorageAccesskey(ctx, accountName, c.common.resourceGroup)
- if err != nil {
- return fmt.Errorf("no key for storage account %s, err %w", accountName, err)
- }
- err = c.common.cloud.deleteVhdBlob(accountName, key, blob)
- if err != nil {
- klog.Warningf("azureDisk - failed to delete blob %s err: %w", diskURI, err)
- detail := err.Error()
- if strings.Contains(detail, errLeaseIDMissing) {
- // disk is still being used
- // see https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.protocol.bloberrorcodestrings.leaseidmissing.aspx
- return volerr.NewDeletedVolumeInUseError(fmt.Sprintf("disk %q is still in use while being deleted", diskURI))
- }
- return fmt.Errorf("failed to delete vhd %v, account %s, blob %s, err: %w", diskURI, accountName, blob, err)
- }
- klog.V(4).Infof("azureDisk - blob %s deleted", diskURI)
- return nil
-
-}
-
-// get diskURI https://foo.blob.core.windows.net/vhds/bar.vhd and return foo (account) and bar.vhd (blob name)
-func (c *BlobDiskController) getBlobNameAndAccountFromURI(diskURI string) (string, string, error) {
- scheme := "http"
- if consts.UseHTTPSForBlobBasedDisk {
- scheme = "https"
- }
- host := fmt.Sprintf("%s://(.*).%s.%s", scheme, consts.BlobServiceName, c.common.storageEndpointSuffix)
- reStr := fmt.Sprintf("%s/%s/(.*)", host, consts.VhdContainerName)
- re := regexp.MustCompile(reStr)
- res := re.FindSubmatch([]byte(diskURI))
- if len(res) < 3 {
- return "", "", fmt.Errorf("invalid vhd URI for regex %s: %s", reStr, diskURI)
- }
- return string(res[1]), string(res[2]), nil
-}
-
-func (c *BlobDiskController) createVHDBlobDisk(blobClient azstorage.BlobStorageClient, accountName, vhdName, containerName string, sizeGB int64) (string, string, error) {
- container := blobClient.GetContainerReference(containerName)
- size := 1024 * 1024 * 1024 * sizeGB
- vhdSize := size + vhd.VHD_HEADER_SIZE /* header size */
- // Blob name in URL must end with '.vhd' extension.
- vhdName = vhdName + ".vhd"
-
- tags := make(map[string]string)
- tags["createdby"] = "k8sAzureDataDisk"
- klog.V(4).Infof("azureDisk - creating page blob %s in container %s account %s", vhdName, containerName, accountName)
-
- blob := container.GetBlobReference(vhdName)
- blob.Properties.ContentLength = vhdSize
- blob.Metadata = tags
- err := blob.PutPageBlob(nil)
- if err != nil {
- // if container doesn't exist, create one and retry PutPageBlob
- detail := err.Error()
- if strings.Contains(detail, errContainerNotFound) {
- err = container.Create(&azstorage.CreateContainerOptions{Access: azstorage.ContainerAccessTypePrivate})
- if err == nil {
- err = blob.PutPageBlob(nil)
- }
- }
- }
- if err != nil {
- return "", "", fmt.Errorf("failed to put page blob %s in container %s: %w", vhdName, containerName, err)
- }
-
- // add VHD signature to the blob
- h, err := createVHDHeader(uint64(size))
- if err != nil {
- _, _ = blob.DeleteIfExists(nil)
- return "", "", fmt.Errorf("failed to create vhd header, err: %w", err)
- }
-
- blobRange := azstorage.BlobRange{
- Start: uint64(size),
- End: uint64(vhdSize - 1),
- }
- if err = blob.WriteRange(blobRange, bytes.NewBuffer(h[:vhd.VHD_HEADER_SIZE]), nil); err != nil {
- klog.Infof("azureDisk - failed to put header page for data disk %s in container %s account %s, error was %s\n",
- vhdName, containerName, accountName, err.Error())
- return "", "", err
- }
-
- scheme := "http"
- if consts.UseHTTPSForBlobBasedDisk {
- scheme = "https"
- }
-
- host := fmt.Sprintf("%s://%s.%s.%s", scheme, accountName, consts.BlobServiceName, c.common.storageEndpointSuffix)
- uri := fmt.Sprintf("%s/%s/%s", host, containerName, vhdName)
- return vhdName, uri, nil
-}
-
-// delete a vhd blob
-func (c *BlobDiskController) deleteVhdBlob(accountName, accountKey, blobName string) error {
- client, err := azstorage.NewBasicClientOnSovereignCloud(accountName, accountKey, c.common.cloud.Environment)
- if err != nil {
- return err
- }
- blobSvc := client.GetBlobService()
-
- container := blobSvc.GetContainerReference(consts.VhdContainerName)
- blob := container.GetBlobReference(blobName)
- return blob.Delete(nil)
-}
-
-//CreateBlobDisk : create a blob disk in a node
-func (c *BlobDiskController) CreateBlobDisk(dataDiskName string, storageAccountType storage.SkuName, sizeGB int) (string, error) {
- klog.V(4).Infof("azureDisk - creating blob data disk named:%s on StorageAccountType:%s", dataDiskName, storageAccountType)
-
- c.initStorageAccounts()
-
- storageAccountName, err := c.findSANameForDisk(storageAccountType)
- if err != nil {
- return "", err
- }
-
- blobClient, err := c.getBlobSvcClient(storageAccountName)
- if err != nil {
- return "", err
- }
-
- _, diskURI, err := c.createVHDBlobDisk(blobClient, storageAccountName, dataDiskName, consts.VhdContainerName, int64(sizeGB))
- if err != nil {
- return "", err
- }
-
- atomic.AddInt32(&c.accounts[storageAccountName].diskCount, 1)
-
- return diskURI, nil
-}
-
-//DeleteBlobDisk : delete a blob disk from a node
-func (c *BlobDiskController) DeleteBlobDisk(ctx context.Context, diskURI string) error {
- storageAccountName, vhdName, err := diskNameAndSANameFromURI(diskURI)
- if err != nil {
- return err
- }
-
- _, ok := c.accounts[storageAccountName]
- if !ok {
- // the storage account is specified by user
- klog.V(4).Infof("azureDisk - deleting volume %s", diskURI)
- return c.DeleteVolume(ctx, diskURI)
- }
-
- blobSvc, err := c.getBlobSvcClient(storageAccountName)
- if err != nil {
- return err
- }
-
- klog.V(4).Infof("azureDisk - About to delete vhd file %s on storage account %s container %s", vhdName, storageAccountName, consts.VhdContainerName)
-
- container := blobSvc.GetContainerReference(consts.VhdContainerName)
- blob := container.GetBlobReference(vhdName)
- _, err = blob.DeleteIfExists(nil)
-
- if c.accounts[storageAccountName].diskCount == -1 {
- if diskCount, err := c.getDiskCount(storageAccountName); err != nil {
- c.accounts[storageAccountName].diskCount = int32(diskCount)
- } else {
- klog.Warningf("azureDisk - failed to get disk count for %s however the delete disk operation was ok", storageAccountName)
- return nil // we have failed to acquire a new count. not an error condition
- }
- }
- atomic.AddInt32(&c.accounts[storageAccountName].diskCount, -1)
- return err
-}
-
-func (c *BlobDiskController) getStorageAccountKey(SAName string) (string, error) {
- if account, exists := c.accounts[SAName]; exists && account.key != "" {
- return c.accounts[SAName].key, nil
- }
-
- ctx, cancel := getContextWithCancel()
- defer cancel()
- listKeysResult, rerr := c.common.cloud.StorageAccountClient.ListKeys(ctx, c.common.resourceGroup, SAName)
- if rerr != nil {
- return "", rerr.Error()
- }
- if listKeysResult.Keys == nil {
- return "", fmt.Errorf("azureDisk - empty listKeysResult in storage account:%s keys", SAName)
- }
- for _, v := range *listKeysResult.Keys {
- if v.Value != nil && *v.Value == "key1" {
- if _, ok := c.accounts[SAName]; !ok {
- klog.Warningf("azureDisk - account %s was not cached while getting keys", SAName)
- return *v.Value, nil
- }
- c.accounts[SAName].key = *v.Value
- return c.accounts[SAName].key, nil
- }
- }
-
- return "", fmt.Errorf("couldn't find key named key1 in storage account:%s keys", SAName)
-}
-
-func (c *BlobDiskController) getBlobSvcClient(SAName string) (azstorage.BlobStorageClient, error) {
- key := ""
- var client azstorage.Client
- var blobSvc azstorage.BlobStorageClient
- var err error
- if key, err = c.getStorageAccountKey(SAName); err != nil {
- return blobSvc, err
- }
-
- if client, err = azstorage.NewBasicClientOnSovereignCloud(SAName, key, c.common.cloud.Environment); err != nil {
- return blobSvc, err
- }
-
- blobSvc = client.GetBlobService()
- return blobSvc, nil
-}
-
-func (c *BlobDiskController) ensureDefaultContainer(storageAccountName string) error {
- var err error
- var blobSvc azstorage.BlobStorageClient
-
- // short circuit the check via local cache
- // we are forgiving the fact that account may not be in cache yet
- if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
- return nil
- }
-
- // not cached, check existence and readiness
- bExist, provisionState, _ := c.getStorageAccountState(storageAccountName)
-
- // account does not exist
- if !bExist {
- return fmt.Errorf("azureDisk - account %s does not exist while trying to create/ensure default container", storageAccountName)
- }
-
- // account exists but not ready yet
- if provisionState != storage.ProvisioningStateSucceeded {
- // we don't want many attempts to validate the account readiness
- // here hence we are locking
- counter := 1
- for swapped := atomic.CompareAndSwapInt32(&c.accounts[storageAccountName].isValidating, 0, 1); !swapped; {
- time.Sleep(3 * time.Second)
- counter = counter + 1
- // check if we passed the max sleep
- if counter >= 20 {
- return fmt.Errorf("azureDisk - timeout waiting to acquire lock to validate account:%s readiness", storageAccountName)
- }
- }
-
- // swapped
- defer func() {
- c.accounts[storageAccountName].isValidating = 0
- }()
-
- // short circuit the check again.
- if v, ok := c.accounts[storageAccountName]; ok && v.defaultContainerCreated {
- return nil
- }
-
- err = kwait.ExponentialBackoff(defaultBackOff, func() (bool, error) {
- _, provisionState, err := c.getStorageAccountState(storageAccountName)
-
- if err != nil {
- klog.V(4).Infof("azureDisk - GetStorageAccount:%s err %s", storageAccountName, err.Error())
- return false, nil // error performing the query - retryable
- }
-
- if provisionState == storage.ProvisioningStateSucceeded {
- return true, nil
- }
-
- klog.V(4).Infof("azureDisk - GetStorageAccount:%s not ready yet (not flagged Succeeded by ARM)", storageAccountName)
- return false, nil // back off and see if the account becomes ready on next retry
- })
- // we have failed to ensure that account is ready for us to create
- // the default vhd container
- if err != nil {
- if errors.Is(err, kwait.ErrWaitTimeout) {
- return fmt.Errorf("azureDisk - timed out waiting for storage account %s to become ready", storageAccountName)
- }
- return err
- }
- }
-
- if blobSvc, err = c.getBlobSvcClient(storageAccountName); err != nil {
- return err
- }
-
- container := blobSvc.GetContainerReference(consts.VhdContainerName)
- bCreated, err := container.CreateIfNotExists(&azstorage.CreateContainerOptions{Access: azstorage.ContainerAccessTypePrivate})
- if err != nil {
- return err
- }
- if bCreated {
- klog.V(2).Infof("azureDisk - storage account:%s had no default container(%s) and it was created \n", storageAccountName, consts.VhdContainerName)
- }
-
- // flag so we no longer have to check on ARM
- c.accounts[storageAccountName].defaultContainerCreated = true
- return nil
-}
-
-// Gets Disk counts per storage account
-func (c *BlobDiskController) getDiskCount(SAName string) (int, error) {
- // if we have it in cache
- if c.accounts[SAName].diskCount != -1 {
- return int(c.accounts[SAName].diskCount), nil
- }
-
- var err error
- var blobSvc azstorage.BlobStorageClient
-
- if err = c.ensureDefaultContainer(SAName); err != nil {
- return 0, err
- }
-
- if blobSvc, err = c.getBlobSvcClient(SAName); err != nil {
- return 0, err
- }
- params := azstorage.ListBlobsParameters{}
-
- container := blobSvc.GetContainerReference(consts.VhdContainerName)
- response, err := container.ListBlobs(params)
- if err != nil {
- return 0, err
- }
- klog.V(4).Infof("azure-Disk - refreshed data count for account %s and found %v", SAName, len(response.Blobs))
- c.accounts[SAName].diskCount = int32(len(response.Blobs))
-
- return int(c.accounts[SAName].diskCount), nil
-}
-
-func (c *BlobDiskController) getAllStorageAccounts() (map[string]*storageAccountState, error) {
- ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
- defer cancel()
- accountList, rerr := c.common.cloud.StorageAccountClient.ListByResourceGroup(ctx, c.common.resourceGroup)
- if rerr != nil {
- return nil, rerr.Error()
- }
-
- accounts := make(map[string]*storageAccountState)
- for _, v := range accountList {
- if v.Name == nil || v.Sku == nil {
- klog.Info("azureDisk - accountListResult Name or Sku is nil")
- continue
- }
- if !strings.HasPrefix(*v.Name, consts.SharedDiskAccountNamePrefix) {
- continue
- }
- klog.Infof("azureDisk - identified account %s as part of shared PVC accounts", *v.Name)
-
- saState := &storageAccountState{
- name: *v.Name,
- saType: (*v.Sku).Name,
- diskCount: -1,
- }
-
- accounts[*v.Name] = saState
- }
-
- return accounts, nil
-}
-
-func (c *BlobDiskController) createStorageAccount(storageAccountName string, storageAccountType storage.SkuName, location string, checkMaxAccounts bool) error {
- bExist, _, _ := c.getStorageAccountState(storageAccountName)
- if bExist {
- newAccountState := &storageAccountState{
- diskCount: -1,
- saType: storageAccountType,
- name: storageAccountName,
- }
-
- c.addAccountState(storageAccountName, newAccountState)
- }
- // Account Does not exist
- if !bExist {
- if len(c.accounts) == maxStorageAccounts && checkMaxAccounts {
- return fmt.Errorf("azureDisk - can not create new storage account, current storage accounts count:%v Max is:%v", len(c.accounts), maxStorageAccounts)
- }
-
- klog.V(2).Infof("azureDisk - Creating storage account %s type %s", storageAccountName, string(storageAccountType))
-
- cp := storage.AccountCreateParameters{
- Sku: &storage.Sku{Name: storageAccountType},
- // switch to use StorageV2 as it's recommended according to https://docs.microsoft.com/en-us/azure/storage/common/storage-account-options
- Kind: consts.DefaultStorageAccountKind,
- Tags: map[string]*string{"created-by": to.StringPtr("azure-dd")},
- Location: &location}
- ctx, cancel := getContextWithCancel()
- defer cancel()
-
- err := c.common.cloud.StorageAccountClient.Create(ctx, c.common.resourceGroup, storageAccountName, cp)
- if err != nil {
- return fmt.Errorf("failed to create Storage Account: %s, error: %v", storageAccountName, err)
- }
-
- newAccountState := &storageAccountState{
- diskCount: -1,
- saType: storageAccountType,
- name: storageAccountName,
- }
-
- c.addAccountState(storageAccountName, newAccountState)
- }
-
- // finally, make sure that we default container is created
- // before handing it back over
- return c.ensureDefaultContainer(storageAccountName)
-}
-
-// finds a new suitable storageAccount for this disk
-func (c *BlobDiskController) findSANameForDisk(storageAccountType storage.SkuName) (string, error) {
- maxDiskCount := maxDisksPerStorageAccounts
- SAName := ""
- totalDiskCounts := 0
- countAccounts := 0 // account of this type.
- for _, v := range c.accounts {
- // filter out any stand-alone disks/accounts
- if !strings.HasPrefix(v.name, consts.SharedDiskAccountNamePrefix) {
- continue
- }
-
- // note: we compute avg stratified by type.
- // this is to enable user to grow per SA type to avoid low
- // avg utilization on one account type skewing all data.
-
- if v.saType == storageAccountType {
- // compute average
- dCount, err := c.getDiskCount(v.name)
- if err != nil {
- return "", err
- }
- totalDiskCounts = totalDiskCounts + dCount
- countAccounts = countAccounts + 1
- // empty account
- if dCount == 0 {
- klog.V(2).Infof("azureDisk - account %s identified for a new disk is because it has 0 allocated disks", v.name)
- return v.name, nil // short circuit, avg is good and no need to adjust
- }
- // if this account is less allocated
- if dCount < maxDiskCount {
- maxDiskCount = dCount
- SAName = v.name
- }
- }
- }
-
- // if we failed to find storageaccount
- if SAName == "" {
- klog.V(2).Infof("azureDisk - failed to identify a suitable account for new disk and will attempt to create new account")
- SAName = generateStorageAccountName(consts.SharedDiskAccountNamePrefix)
- err := c.createStorageAccount(SAName, storageAccountType, c.common.location, true)
- if err != nil {
- return "", err
- }
- return SAName, nil
- }
-
- disksAfter := totalDiskCounts + 1 // with the new one!
-
- avgUtilization := float64(disksAfter) / float64(countAccounts*maxDisksPerStorageAccounts)
- aboveAvg := avgUtilization > storageAccountUtilizationBeforeGrowing
-
- // avg are not create and we should create more accounts if we can
- if aboveAvg && countAccounts < maxStorageAccounts {
- klog.V(2).Infof("azureDisk - shared storageAccounts utilization(%v) > grow-at-avg-utilization (%v). New storage account will be created", avgUtilization, storageAccountUtilizationBeforeGrowing)
- SAName = generateStorageAccountName(consts.SharedDiskAccountNamePrefix)
- err := c.createStorageAccount(SAName, storageAccountType, c.common.location, true)
- if err != nil {
- return "", err
- }
- return SAName, nil
- }
-
- // averages are not ok and we are at capacity (max storage accounts allowed)
- if aboveAvg && countAccounts == maxStorageAccounts {
- klog.Infof("azureDisk - shared storageAccounts utilization(%v) > grow-at-avg-utilization (%v). But k8s maxed on SAs for PVC(%v). k8s will now exceed grow-at-avg-utilization without adding accounts",
- avgUtilization, storageAccountUtilizationBeforeGrowing, maxStorageAccounts)
- }
-
- // we found a storage accounts && [ avg are ok || we reached max sa count ]
- return SAName, nil
-}
-
-//Gets storage account exist, provisionStatus, Error if any
-func (c *BlobDiskController) getStorageAccountState(storageAccountName string) (bool, storage.ProvisioningState, error) {
- ctx, cancel := getContextWithCancel()
- defer cancel()
- account, rerr := c.common.cloud.StorageAccountClient.GetProperties(ctx, c.common.resourceGroup, storageAccountName)
- if rerr != nil {
- return false, "", rerr.Error()
- }
- return true, account.AccountProperties.ProvisioningState, nil
-}
-
-func (c *BlobDiskController) addAccountState(key string, state *storageAccountState) {
- accountsLock.Lock()
- defer accountsLock.Unlock()
-
- if _, ok := c.accounts[key]; !ok {
- c.accounts[key] = state
- }
-}
-
-func createVHDHeader(size uint64) ([]byte, error) {
- h := vhd.CreateFixedHeader(size, &vhd.VHDOptions{})
- b := new(bytes.Buffer)
- err := binary.Write(b, binary.BigEndian, h)
- if err != nil {
- return nil, err
- }
- return b.Bytes(), nil
-}
-
-func diskNameAndSANameFromURI(diskURI string) (string, string, error) {
- uri, err := url.Parse(diskURI)
- if err != nil {
- return "", "", err
- }
-
- hostName := uri.Host
- storageAccountName := strings.Split(hostName, ".")[0]
-
- segments := strings.Split(uri.Path, "/")
- diskNameVhd := segments[len(segments)-1]
-
- return storageAccountName, diskNameVhd, nil
-}
diff --git a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go
index ccb4c76505..965b3b3b0d 100644
--- a/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go
+++ b/vendor/sigs.k8s.io/cloud-provider-azure/pkg/provider/azure_controller_common.go
@@ -41,17 +41,11 @@ import (
)
const (
- // for limits check https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits#storage-limits
- maxStorageAccounts = 100 // max # is 200 (250 with special request). this allows 100 for everything else including stand alone disks
- maxDisksPerStorageAccounts = 60
- storageAccountUtilizationBeforeGrowing = 0.5
// Disk Caching is not supported for disks 4 TiB and larger
// https://docs.microsoft.com/en-us/azure/virtual-machines/premium-storage-performance#disk-caching
diskCachingLimit = 4096 // GiB
maxLUN = 64 // max number of LUNs per VM
- errLeaseIDMissing = "LeaseIdMissing"
- errContainerNotFound = "ContainerNotFound"
errStatusCode400 = "statuscode=400"
errInvalidParameter = `code="invalidparameter"`
errTargetInstanceIds = `target="instanceids"`